Quickstart

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.

  1. Install logman:

    $ pip install logman
    
  2. Import and use the logger:

     1from logman import LoggerFactory
     2
     3class MyClass:
     4   def __init__(self):
     5      self.logger = LoggerFactory.getLogger(self.__class__.__name__)
     6
     7   def my_method(self):
     8      self.logger.info('Hello, World!')
     9
    10myClass = MyClass()
    11myClass.my_method()
    
    $ python my_script.py
    {"context": "MyClass", "level": "INFO", "timestamp": "2024-07-24 16:25:10.016", "message": "Hello, World!", "thread": "MainThread"}