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.4.0.tar.gz
(22.4 kB
view details)
Built Distribution
loggext-0.4.0-py3-none-any.whl
(25.1 kB
view details)
File details
Details for the file loggext-0.4.0.tar.gz
.
File metadata
- Download URL: loggext-0.4.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba08db041befebd5d51f233e07622912a9ca49f68bb23091df0d6755dcaadb14 |
|
MD5 | 627e835211589990f8ea806c36c4cbbe |
|
BLAKE2b-256 | c358772d711527bb21d0cabe281b25d791b01cb138b8bfc938dc8b5bc7f5f594 |
File details
Details for the file loggext-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: loggext-0.4.0-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | eceeb6d4592249427a75cb39e2d9259dac992f21614e524855e4643d5f9d87a9 |
|
MD5 | 61347f200e30a0f3df2b1695e1a319f3 |
|
BLAKE2b-256 | 0d0152c523aac530803eee0810ec08d7cca4929d55cf6a3b0fa7f7a09bfae6e7 |