Skip to main content

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

Metadata

Release files for loggext 0.4.1

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

Source distribution (sdist)

Source distribution for loggext 0.4.1
File Size Uploaded
loggext-0.4.1.tar.gz 22.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for loggext 0.4.1
File Interpreter ABI Platform
loggext-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 47.5 kB

Release files / loggext-0.4.1.tar.gz

Download URL loggext-0.4.1.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4b4980cc2ebca58752aca873c7c872543cc924416a3b4f089f02ea513dac4c6e
BLAKE2b-256 checksum
How to use checksums
1001c84a67f6de525c0703d1b7161bb21c3ee7c8c7bfe3028a6a1faac387f581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / loggext-0.4.1-py3-none-any.whl

Download URL loggext-0.4.1-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99770e519c244baacf21c35d4e70121d3994da1488a4ad850a39c4443bd05c25
BLAKE2b-256 checksum
How to use checksums
1dae96c4c5b17428146008f38c7827489bd17ba297fa7defbcaf2bc9de938efb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.0

3 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