Skip to content

WIM-Corporation/logman

Repository files navigation

logman

logman is inspired by the SLF4J LoggerFactory from the Spring ecosystem. It aims to provide a similar experience for Python developers, featuring JSON logging and log rotation capabilities.

visit https://logman.wimcorp.dev

Quickstart

  1. Install logman
$ pip install logman
  1. Import and use the logger
from logman import LoggerFactory

class MyClass:
  def ___init___(self):
    self.logger = LoggerFactory.getLogger(self.__class__.__name__)

  def my_method(self):
      self.logger.info('Hello, World!')

myClass = MyClass()
myClass.my_method()
$ python my_script.py
{"context": "MyClass", "level": "INFO", "timestamp": "2024-07-24 16:25:10.016", "message": "Hello, World!", "thread": "MainThread"}

Run Tests

pytest

pip install pytest
python -m unittest discover -s tests -p 'test_*.py'

tox

pip install -r requirements-test.txt
tox

Build Docs

Sphinx

pip install -r requirements-docs.txt
make -C docs html

# Output path: docs/_build/html