Skip to main content

logging extensions for pythons logging library

Project description

loggext-py

logging extensions for pythons logging library

Installation

pip install loggext

Features

  • function-decorators for logging
    • with support for asnyc-functions
  • additional logging-handlers
    • ColoredConsoleHandler

Usage

import logging
import loggext
from loggext.decorators import add_logging

# only configures if not already configured
if not loggext.logging_is_configured():
    logging.basicConfig(
        level=logging.NOTSET,
        handlers=[
            # adds colored output based on the level of each message
            loggext.handlers.ColoredConsoleHandler()
        ],
    )

@add_logging(
  call=True,  # logs when the function is called
  call_args=True,  # logs passed arguments of call
  timeit=True,   # measure performance of the function
  timeit_precision=2,  # number of units when formatting timing
  result=True,  # log the result
)  # note: exception-logging is always
def myfn(arg):
    ...  # stuff

myfn("value")
# DEBUG:root:<function myfn at 0x7f06a6cc3400> was called with ('value')
# DEBUG:root:<function myfn at 0x7f06a6cc3400> returned None after 65μs+614ns

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

loggext-0.2.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

loggext-0.2.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file loggext-0.2.0.tar.gz.

File metadata

  • Download URL: loggext-0.2.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for loggext-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2339dad56bf24f01b44602f283c2689a53d8dc5f64476cfc3f09d709b9d64afe
MD5 31004b309d97efaaf9ac5ad7d633e101
BLAKE2b-256 940e25860692eae07c9ccd06ce139292d8bde79e5c535823150a0c5b073ae53b

See more details on using hashes here.

File details

Details for the file loggext-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: loggext-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for loggext-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 488101f946736cad83468792225e588ec4854edc9e8131a7f711b6f220064591
MD5 aefa23865f5cd033379214e78fc76863
BLAKE2b-256 f5fa3345d5cde17694d250c3345032d4055ec627a1fb8832496297bf5126b9c0

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