Skip to main content

A set of classes and functions that extend the log package.

Project description

uc_logging

A set of classes and functions that extend the log package.

It is part of the Unicon project.

https://unicon.10k.me

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.")

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

uc_logging-0.0.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uc_logging-0.0.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file uc_logging-0.0.1.tar.gz.

File metadata

  • Download URL: uc_logging-0.0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for uc_logging-0.0.1.tar.gz
Algorithm Hash digest
SHA256 caaf7f977cd5ef5679061743a9ad6c0c1dfaf7d5519d6d668b46257914068611
MD5 2589bb350a4e747107b6fbc0f819b86a
BLAKE2b-256 a103103430ccf53551414cf93e4f54a9aa5f74793d13e4bdee5a7b4b65379104

See more details on using hashes here.

File details

Details for the file uc_logging-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: uc_logging-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for uc_logging-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d93bedbfd3647cffd8cdfcd34a2845469dd3c95cfb4b9320c881c8fb76f25032
MD5 7cdb587cbd9d386b0cd7026093c741c9
BLAKE2b-256 6a8bdb0b953db7eaa5a6819ce644267e148d6d2bee3f74c7ef8ae295405c074c

See more details on using hashes here.

Supported by

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