Automatic logging from Python to Loki.
Project description
Ploki
Automatic logging from Python to Loki.
Usage
Send all logs
import logging from ploki import Ploki, ignore_logger Ploki().initialize( url="http://localhost:3100", tags={"application": "ploki"}, level=logging.INFO, ) ignore_logger("ignored") logger = logging.getLogger("my-app") ignored = logging.getLogger("ignored") logger.info( "This log will be sent to Loki.", extra={"tags": {"custom": "label"}}, ) ignored.warning("This logger will be ignored.") # reinitialize Ploki().initialize( url="http://localhost:3100", auth=("user", "password"), ) with ignore_logger("my-app"): logger.error("This message will not be sent.") ignore_logger("you", "can", "pass", "multiple", "loggers") Ploki().terminate() # disable Ploki
Credits
The original Loki handler and emitter by courtesy of Andrey Maslov.
Python logging integration is based on Sentry.
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.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size ploki-0.4.1-py3-none-any.whl (7.4 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size ploki-0.4.1.tar.gz (4.8 kB) | File type Source | Python version None | Upload date | Hashes View |