Skip to content

raggy.utilities.logging

Module for logging utilities.

RaggyLogger

A subclass of the standard library logging.Logger class that adds methods for logging with styles and key-value pairs.

get_logger cached

Retrieves a logger with the given name, or the root logger if no name is given.

Parameters:

Name Type Description Default
name str | None

The name of the logger to retrieve.

None

Returns:

Type Description
RaggyLogger

The logger with the given name, or the root logger if no name is given.

Example

Basic Usage of get_logger

from raggy.utilities.logging import get_logger

logger = get_logger("raggy.test")
logger.info("This is a test") # Output: raggy.test: This is a test

debug_logger = get_logger("raggy.debug")
debug_logger.debug_kv("TITLE", "log message", "green")