Simplifies logging for systemd
Project description
https://github.com/idlesign/systemd-logging
Description
Simplifies logging for systemd
Requires Python 3.6+
No need to compile (pure Python), uses libsystemd.so.
Simplified configuration.
Just logging. Nothing more.
Usage
import logging
from systemdlogging.toolbox import init_systemd_logging
# This one line in most cases would be enough.
init_systemd_logging()
# By default it attaches systemd logging handler to a root Python logger.
# Now you can use logging as usual.
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.debug('My debug message')
try:
raise ValueError('Log me please')
except ValueError:
# Additional context can be passed in extra.context.
logger.exception('Something terrible just happened', extra={
'message_id': True, # Generate message ID automatically.
'context': {
'FIELD1': 'one',
'FIELD2': 'two',
}
}, stack_info=True)
Read the docs to find out more.
Documentation
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
systemd-logging-0.1.0.tar.gz
(11.2 kB
view hashes)
Built Distribution
Close
Hashes for systemd_logging-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9ca725af023ed138082380d9559cf8b3e566d4266502a35d8844fb6d8b858b3 |
|
MD5 | ecb8723af3ae137441830fa47a93a4b3 |
|
BLAKE2b-256 | f0eea5a76f63b3cad6d39191d27cae76be94e83e62f408f3f73f47f9800c6816 |