Async-compatible, dependency-less log suppression and filtering lib
  • Python 92.5%
  • Makefile 7.5%
Find a file
2023-10-02 22:57:20 +02:00
shush feat: update README, add install section 2023-10-02 22:57:20 +02:00
tests feat: basefiles 2023-10-02 22:46:29 +02:00
.gitignore feat: basefiles 2023-10-02 22:46:29 +02:00
.pre-commit-config.yaml feat: basefiles 2023-10-02 22:46:29 +02:00
LICENSE feat: basefiles 2023-10-02 22:46:29 +02:00
Makefile feat: basefiles 2023-10-02 22:46:29 +02:00
noxfile.py feat: basefiles 2023-10-02 22:46:29 +02:00
pdm.lock feat: basefiles 2023-10-02 22:46:29 +02:00
pyproject.toml feat: update README, add examples 2023-10-02 22:54:20 +02:00
README.md feat: update README, add install section 2023-10-02 22:57:20 +02:00

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\n