logging extensions for pythons logging library
Project description
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.3.0.tar.gz
(21.7 kB
view details)
Built Distribution
loggext-0.3.0-py3-none-any.whl
(24.1 kB
view details)
File details
Details for the file loggext-0.3.0.tar.gz
.
File metadata
- Download URL: loggext-0.3.0.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | deb1c5d5a6865e9fe0175e50837e6355c3b50cb96182120ae70205990ffa57c0 |
|
MD5 | 64b16c7501dd20c158024cb4028b22e4 |
|
BLAKE2b-256 | b5d735e18c987b05918c7ce5a7b2040a36113659d0248d644ea4087c2a29873a |
File details
Details for the file loggext-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: loggext-0.3.0-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe2f44a55be0d3787c723545da00eb1472c7a99a2022914165f5168b69ee1d2e |
|
MD5 | 875f25472bafaf108d162f337967c90c |
|
BLAKE2b-256 | b0b01069cdfbabf9be0d382747868af3e5ae8e4a338fd4666c1ebbc4923cd21b |