A collection of useful logging tools
Project description
logging_extras
A collection of useful logging tools for Python 3.
Installation
The majority of the tools in this library require no additional dependencies. To install the library with the base functionality use the following command.
pip install logging-extras
To use the MQTT*
classes, install the library with the following command.
pip install logging-extras[mqtt]
Tools
MQTTConfig
- A configuration class for an MQTT connection.MQTThandler
- A logging handler that publishes logs to an MQTT broker.MQTTSubscriber
- A logging listener that subscribes to an MQTT broker and logs messages.RelativeTimeFilter
- A logging filter that adds a relative time to the log record.DiffTimeFilter
- A logging filter that adds a time difference to the log record.TieredFormatter
- A logging formatter that allows for different formatting based on the log level.log_function_call
- A decorator that logs the arguments and return value of a function call.
Examples
log_function_call
from logger_extras import log_function_call
@log_function_call(level=logging.INFO)
def add(a, b):
return a + b
_ = add(1, 2)
# This will log the following:
# 2021-08-03 12:00:00,000 - INFO - Calling __main__.add(a=1, b=2)
# 2021-08-03 12:00:00,000 - INFO - '__main__.add' returned 3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file logger_extras-0.0.1rc1.tar.gz
.
File metadata
- Download URL: logger_extras-0.0.1rc1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26b9e061b7c7abe94d001d8db9246cfadb1f2bf78648fade04b7f946a7f6e09e |
|
MD5 | 1ab4998c4264992763e5e5c2e53a561d |
|
BLAKE2b-256 | 82df8115673cab5aed50b626b065222b223dcf0f047299254ec896a3e461be12 |
Provenance
File details
Details for the file logger_extras-0.0.1rc1-py3-none-any.whl
.
File metadata
- Download URL: logger_extras-0.0.1rc1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f71ed1fc50b9dcb10fdab9f06d8b10d48df711f732515da953695e4b4caacd0 |
|
MD5 | 095cef67fd87a4675a98564a4fb2e5af |
|
BLAKE2b-256 | 80b13d7645e23dcce9f54b3a1da70a39df22418ceb070c23a57378769109e343 |