logconf
Setting up logging in Python is verbose and error prone. This library aims to fix that, without replacing the standard library logging entirely.
import logging
from logconf import global_logconf
with global_logconf() as logger:
# simple example:
logger.log_to_console_if_interactive(level=logging.DEBUG)
if os.getenv('LOG_DEST'): # can be "stdout" or "stderr"
logger.log_to_file(os.getenv('LOG_DEST'), level=os.getenv('LOG_LEVEL'))
# more fine-grained control:
logger.log_json_to_file('/var/log/myapp.jsonlog', level=logging.WARNING)
logger.log_json_to_file('/var/log/myapp_debug.jsonlog', level=logging.DEBUG)
# configure sub-loggers:
with logger.logger('urllib3') as sublogger:
sublogger.level = logging.WARNING
with logger.logger('myapp.security') as sublogger:
sublogger.log_to_file('/var/log/myapp.security.log', level=logging.INFO)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logconf-0.2.1.tar.gz
(4.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
logconf-0.2.1-py3-none-any.whl
(10.4 kB
view details)
File details
Details for the file logconf-0.2.1.tar.gz.
File metadata
- Download URL: logconf-0.2.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/0.11.4 CPython/3.7.0 Linux/4.17.0-0.bpo.1-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbb42ca04128564fe3b6fe85ed74e399c314cef19eb8df8e43e5d772c4b8b0fb
|
|
| MD5 |
7b39fa22cbe4641768330e8db7ad6adc
|
|
| BLAKE2b-256 |
4bef7fceaac629cc4d42c817de747bab00fdc5c8b7aaf2e4b947735188fd8459
|
File details
Details for the file logconf-0.2.1-py3-none-any.whl.
File metadata
- Download URL: logconf-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/0.11.4 CPython/3.7.0 Linux/4.17.0-0.bpo.1-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db4de70c54ec34a3d045dba2bb1558c5864c34d2ea802e00377bdb9b8d220067
|
|
| MD5 |
f51339772f7e280578d33dc9c533c914
|
|
| BLAKE2b-256 |
4bed91e7b4cd0c47b0976aea62273e486977bf54c9e457b9a5db2413ba37f7dc
|