semvec/pypi-packages huggingface dataset:
logbot-parf 0.0.1
Logs manager with mute log feature at different levels: process, server, cluster
Requires Python: >=3.6

# Logbot v0.1

Simplify the use of logs (based on build-in logging) with the ability to configure a pause in sending messages, even if the service is running on different servers.

## Install

    pip install logbot

## Example

This example sets up a Lobot (DEBUG as main level) with a Syslog handler and a Slack handler with a 5-second mute using Memcached.

This allows all DEBUG-level messages to be written to syslog and CRITICAL level messages to be sent to the Slack channel, but no more than once every 5 seconds.
Since Memcached (in this case) is used as the backend for mute, it'll work across the entire cluster if the service is running on multiple servers.

```python
import logging

from logbot import Logbot, Logpart
from logbot.logmute import LogmuteMemcached
from logbot.handlers import SysLogbotHandler, SlackLogbotHandler

lbot = Logbot(
    service='my_service',  # your service name
    level=logging.DEBUG,   # main log level
    logparts=[
        Logpart(SysLogbotHandler()),  # add Syslog handler, you can use any logging.Handler
        Logpart(                      # add Slack handler
            handler=SlackLogbotHandler("<token>"),
            level=logging.CRITICAL,  # send only critical messages to Slack
            mute_seconds=5  # after sending a message, mute the sending for 5 seconds
        )
    ],
    logmute=LogmuteMemcached([('127.0.0.1', 11211)])  # use Memcached for the mute feature (pymemcache lib required)
)

log = lbot.get_log()
log.debug("Test debug message")  # send to syslog
log.info("Test info message")  # send to syslog
log.critical("Test critical message")  # send to syslog and slack
```

Copyright (C) 2022 by Dmitry Parfyonov <parfyonov.dima@gmail.com>  
MIT License, see http://opensource.org/licenses/MIT