Metadata-Version: 2.5
Name: systemd-logging
Version: 1.0.2
Summary: Simplifies logging for systemd
Project-URL: Homepage, https://github.com/idlesign/systemd-logging
Author-email: Igor Starikov <idlesign@yandex.ru>
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: journal,logging,systemd
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: ctyped>=0.7.1
Description-Content-Type: text/markdown

# systemd-logging

<https://github.com/idlesign/systemd-logging>

[![release](https://img.shields.io/pypi/v/systemd-logging.svg)](https://pypi.python.org/pypi/systemd-logging)
[![lic](https://img.shields.io/pypi/l/systemd-logging.svg)](https://pypi.python.org/pypi/systemd-logging)
[![coverage](https://img.shields.io/coveralls/idlesign/systemd-logging/master.svg)](https://coveralls.io/r/idlesign/systemd-logging)

## Description

*Simplifies logging for systemd*

**Requires Python 3.10+**

* No need to compile (pure Python), uses `libsystemd.so`.
* Simplified configuration.
* Just logging. Nothing more.

## Usage

```python
import logging

from systemdlogging.toolbox import init_systemd_logging

# This one line in most cases would be enough.
# By default it attaches systemd logging handler to a root Python logger.
init_systemd_logging()  # Returns True if initialization went fine.

# 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)
```
