pysiral._logger

A small module to handle logging in pysiral. This module is intended to be the first module called in pysiral.__init__.py, so that the logger is set up before any other modules are imported.

Classes

InterceptHandler

Handler instances dispatch logging events to specific destinations.

Functions

get_duration(→ str)

Get a formatted string representing the duration from a given number of elapsed seconds.

logger_format(→ str)

Formatter function for loguru (Normal mode

logger_format_debug(→ str)

set_logger(→ None)

Set up the logger for pysiral.

Module Contents

class pysiral._logger.InterceptHandler(level=NOTSET)

Bases: logging.Handler

Handler instances dispatch logging events to specific destinations.

The base handler class. Acts as a placeholder which defines the Handler interface. Handlers can optionally use Formatter instances to format records as desired. By default, no formatter is specified; in this case, the ‘raw’ message as determined by record.message is logged.

emit(record)

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

pysiral._logger.get_duration(elapsed_seconds: int, fmt_str: str = '%H:%M:%S') str

Get a formatted string representing the duration from a given number of elapsed seconds.

pysiral._logger.logger_format(record: Dict) str

Formatter function for loguru (Normal mode

Parameters:

record

Returns:

logger string

pysiral._logger.logger_format_debug(record: Dict) str
pysiral._logger.set_logger() None

Set up the logger for pysiral.