uc_logging
A set of classes and functions that extend the log package.
It is part of the Unicon project.
Usage:
Install
pip install --user uc-logging
and use
import uc_logging
Functions:
Classes:
Formatter(default=logging.BASIC_FORMAT, formats=None)
Multi formatter. Adds the ability to format log messages based on their level.
Formats is a dict where key is a level and value it's a format.
UnbufferedStreamHandler(stream)
Unbuffered stream handler.
When multiprocessing queue is used (for example), standard output may stuck. Common flushing not working. Using -u option not guaranteed (it helps). So write directly.
Example:
import logging
import uc_logging
format_standard_a = "%(asctime)s [%(levelname)s] - %(message)s"
format_standard_d = "%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s"
logger = logging.getLogger("formatter_test")
logger.handlers.clear()
logger.setLevel(logging.DEBUG)
# Set multi formatter
formatter = uc_logging.Formatter(default=format_standard_a, formats={logging.DEBUG: format_standard_d})
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.info("TEST FORMATTER.")
logger.debug("TEST FORMATTER.")
Release files for uc-logging 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uc_logging-0.0.2.tar.gz | 2.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uc_logging-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.9 kB
Release files / uc_logging-0.0.2.tar.gz
| Download URL | uc_logging-0.0.2.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a24907b27c0edee95c5f823b70537bb85df5e127a745e3b08d930124232ffc8a
|
|
BLAKE2b-256 checksum How to use checksums |
2b59d8d2a4bd04b19720d15a97acd2349c1195eccb6fe507c83dda340aec3f24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
|
Release files / uc_logging-0.0.2-py3-none-any.whl
| Download URL | uc_logging-0.0.2-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b19bd2494a946f3664c64548dba0f42ede4b06178594315bbb72b524f775f302
|
|
BLAKE2b-256 checksum How to use checksums |
45fc0e0d3854523a9fd4e00674a13fbf928361d13b29cb1715efd243ff322296
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7
|