Lumberpy is an easily configurable python3 module for advanced logging use cases
Project description
Lumberpy
- Free software: MIT license
Config format
The config format is based on the (python standard lib dict config format)[https://docs.python.org/3/howto/logging-cookbook.html#an-example-dictionary-based-configuration]. There are a few extra keys and more defaults.
- By default a colored formatter based on ... is used.
Default log format
"{asctime} {levelname:3.3} {name}: {message}"
Example:
Reasoning:
- TODO
Usage Logging configuration
Applications using lumber usually have three ways to configure logging:
- via the CLI (e.g.
-vto set log leve toDEBUG) - via config file (path provided by cli or environment variable)
- via environment variables
If several are provided precedence in that order. For example:
- If
-vis provided log level from config file and via environment variable, the later two are ignored - If providing a config path via cli and via environment variable only former is used.
Environment variables
The following variables are available
LUMBER_CONFIG_PATHload config from provided pathLUMBER_LEVELsets the log level, (e.g. DEBUG or as integer 1 to 60)LUMBER_FORMATto set the default log format.
How to include in your software
import lumberpy
LOG = logging.getLogger(__name__)
@click.command()
@click.option('--lumberpy-config-path', type=click.Path())
@click.option('-v', '--verbose', count=True)
def main(lumberpy_config_path, verbose):
"""Console script for python_boilerplate."""
lumberpy.setup(lumberpy_config_path, verbose)
LOG.warning("A waring")
return 0
With the main goal of lumberpy being to cut down on boilerplate there is an even shorter way to add the click options:
import lumberpy.click
@click.command()
@lumberpy.click.options()
def main(lumberpy_config_path, verbose):
lumberpy.setup(lumberpy_config_path, verbose)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file lumberpy-0.1.0.tar.gz.
File metadata
- Download URL: lumberpy-0.1.0.tar.gz
- Upload date:
- Size: 38.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49d30a2c877a2aa60bb560ab3f922214c136de2cae602e0f30fae59e6be93f77
|
|
| MD5 |
74c3765f603bf98af9422acb8780a234
|
|
| BLAKE2b-256 |
95ea34ee0545b622394326bfe409d4ea14c24711b81bb3a1ba76c2d93bb6e8c0
|
File details
Details for the file lumberpy-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: lumberpy-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6ed3ae7c23810fc14804a970feebe196750144c6b7a0d78d7481a98aff4ad10
|
|
| MD5 |
ae5e2c17a8634b6e9eb27bcfa3d2c0e3
|
|
| BLAKE2b-256 |
07ae3538e3a5a37b89e44cba9fc7ae7f9c1796274d3247586d7b73b1af96eb6e
|