LoggingΒΆ

Minoshiro logs errors and debug information via the logging Python module. The library comes with a basic logger that prints to STDERR. It is strongly recommended you log to a log file in addition to printing to STDERR.

Configuration of the logger can be as simple as:

from logging import FileHandler, Formatter

from minoshiro import get_default_logger

logger = get_default_logger()
file_handler = FileHandler(filename='my_log_file.log')
file_handler.setFormatter(
    Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s')
)
logger.addHandler(file_handler)

More advance setups are possible with the logging module. You can configure the logger to your liking as such:

from logging import getLogger

import minoshiro

my_logger = getLogger('minoshiro')

...

And finally, if you already have a logger set up in your application, you can simply use the existing logger instead of the one provided by the library.