Logmuse: Logging Setup

0.3.0 · active · verified Thu Apr 16

Logmuse is a lightweight Python library designed to simplify the setup of basic logging for applications. It provides utilities to configure named loggers, set log levels, and integrate logging options with `argparse`. The current version is 0.3.0, and it maintains a relatively stable release cadence with minor updates.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a named logger using `setup_logging` and emit various log messages. Remember to call `setup_logging` before your logger instance (`_LOGGER`) starts emitting messages to ensure handlers are configured.

import logging
from logmuse import setup_logging

# Get a logger instance for your application
_LOGGER = logging.getLogger("my_app")

def main():
    # Setup logging to console at INFO level for 'my_app'
    # Set 'level="DEBUG"' to see more detailed messages
    setup_logging(name="my_app", level="INFO")
    
    _LOGGER.info("Application started successfully!")
    _LOGGER.debug("This debug message will not be shown by default with INFO level.")
    _LOGGER.warning("This is a warning message.")
    _LOGGER.error("An error occurred, but the app continues.")

if __name__ == "__main__":
    main()

view raw JSON →