Skip to main content

logging-toolbox

Project description

logging-toolbox

Build Status

The logging-toolbox module contains useful functions to help the user with logging recurring things like command-line arguments and dependencies on startup.

Usage

Logging program arguments and dependencies

Suppose we have a Python program that has the dependencies dep1 and dep2, and takes the command-line arguments --server-url, --one-argument and --some-hex-value. We'll assume the module the program is a part of is called simple_program. Upon startup, we can log the versions of our dependencies and all arguments.

from .utils import get_args, setup_logging

from logging_toolbox.startup import startup_log
from logging_toolbox.utils import clean_url


if __name__ == '__main__':
    arguments = get_args()
    setup_logging()

    startup_log(arguments,
                critical_modules=['simple_program', 'dep1', 'dep2'],
                cleaners={'server_url': clean_url,
                          'some_hex_value': '0x{:04X}'.format})

This should log something like:

=================CONFIG=================
----------------Versions----------------
simple_program : UNKNOWN
dep1           : 0.3.2.dev23
dep2           : 1.0.1
---------------Arguments----------------
one_argument   : argument value
server_url     : https://user:******@server/
some_hex_value : 0x02FF
=======================================

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logging-toolbox-0.2.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

logging_toolbox-0.2.0-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file logging-toolbox-0.2.0.tar.gz.

File metadata

  • Download URL: logging-toolbox-0.2.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for logging-toolbox-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7f198289ce76580bfd5423f8c416cc6e4549b911260bab641e022925c5909dfa
MD5 41b1222affd1559606045f61ee20c9e2
BLAKE2b-256 e87722f785a054c9cfb510e1b6ed03d02364288fc489e263d6c78b0ab11ec8e4

See more details on using hashes here.

File details

Details for the file logging_toolbox-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: logging_toolbox-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for logging_toolbox-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3b18fe2aed74e2404e7e95bc55c8f60cb7cf71ba1289950fb75cfdedb2308339
MD5 019e1a15d79d1ecbc6204d2298629cdb
BLAKE2b-256 db316d22c66f4eecfa1da969c0f824da15f423b117c4fbbc40c70d65eec4a529

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page