Skip to main content

logging extensions for pythons logging library

Project description

PyPI - Version

loggext-py

logging extensions for pythons logging library

See the Documentation.

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):
    ...  # your code

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.4.1.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

loggext-0.4.1-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for loggext-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4b4980cc2ebca58752aca873c7c872543cc924416a3b4f089f02ea513dac4c6e
MD5 744704b980e98301c749d57983fa5ff6
BLAKE2b-256 1001c84a67f6de525c0703d1b7161bb21c3ee7c8c7bfe3028a6a1faac387f581

See more details on using hashes here.

File details

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

File metadata

  • Download URL: loggext-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 25.1 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.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99770e519c244baacf21c35d4e70121d3994da1488a4ad850a39c4443bd05c25
MD5 6a2aa1aa3a3eaba8c1bdc8a75165787c
BLAKE2b-256 1dae96c4c5b17428146008f38c7827489bd17ba297fa7defbcaf2bc9de938efb

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