shushlog (0.1.1)

Published 2023-10-03 06:20:35 +00:00 by catalin in catalin/shushlog

Installation

pip install --index-url  shushlog

About this package

Simple logs supressor and filter

shushlog

PyPI PyPI - License PyPI - Python Version pdm-managed

Async-compatible, dependency-less, simple log suppression and filtering lib

Install

pip install shushlog

TLDR

  • supress all logs
>>> import logging
>>> import shush
>>> logging.basicConfig()
>>> logger = logging.getLogger("some_logger")
>>> logger.setLevel(logging.INFO)
>>> @shush.suppress
>>> def suppressed_func():
>>>     logger.info("this should not be logged")
>>> def normal_func():
>>>     logger.info("this should be logged")
>>> suppressed_func()
>>> normal_func()
INFO:some_logger:this should be logged
  • muzzle text
>>> import logging
>>> import shush
>>> logging.basicConfig()
>>> logger = logging.getLogger("some_logger")
>>> logger.setLevel(logging.INFO)
>>> @shush.muzzle("foo")
>>> def muzzled_func():
>>>     logger.info("this contains `foo`, so it should be muzzled out")
>>>     logger.info("this doesn't contain it, so it should be showing")
>>> muzzled_func()
INFO:some_logger:this doesn't contain it, so it should be showing

Requirements

Requires Python: >=3.10
Details
PyPI
2023-10-03 06:20:35 +00:00
28
GPL-3.0-or-later
29 KiB
Assets (2)
Versions (3) View all
0.1.1 2023-10-03
0.1.0 2023-10-02
0.0.0 2023-10-02