Skip to main content

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:

  1. via the CLI (e.g. -v to set log leve to DEBUG)
  2. via config file (path provided by cli or environment variable)
  3. via environment variables

If several are provided precedence in that order. For example:

  • If -v is 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_PATH load config from provided path
  • LUMBER_LEVEL sets the log level, (e.g. DEBUG or as integer 1 to 60)
  • LUMBER_FORMAT to 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)

Metadata

Release files for lumberpy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lumberpy 0.1.0
File Size Uploaded
lumberpy-0.1.0.tar.gz 38.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lumberpy 0.1.0
File Interpreter ABI Platform
lumberpy-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 44.5 kB

Release files / lumberpy-0.1.0.tar.gz

Download URL lumberpy-0.1.0.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
49d30a2c877a2aa60bb560ab3f922214c136de2cae602e0f30fae59e6be93f77
BLAKE2b-256 checksum
How to use checksums
95ea34ee0545b622394326bfe409d4ea14c24711b81bb3a1ba76c2d93bb6e8c0
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / lumberpy-0.1.0-py2.py3-none-any.whl

Download URL lumberpy-0.1.0-py2.py3-none-any.whl
Size 6.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f6ed3ae7c23810fc14804a970feebe196750144c6b7a0d78d7481a98aff4ad10
BLAKE2b-256 checksum
How to use checksums
07ae3538e3a5a37b89e44cba9fc7ae7f9c1796274d3247586d7b73b1af96eb6e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page