embutils.utils.logger module

SDK logger implementation.

date

2021

author

Christian Wiche

contact

cwichel@gmail.com

license

The MIT License (MIT)

class embutils.utils.logger.Logger(name: str = '', level: embutils.utils.logger.Logger.Level = Level.DEBUG, fmt: embutils.utils.logger.Format = Format(style='{', pattern='{created:.05f}: {name:<8s}: {levelname:<8s}: {module:<20s}: {message:s}'))[source]

Bases: logging.Logger

Logger implementation wrapper. This class simplifies the logger formatting and level definition for the SDK.

Logger configuration. Applies the log entries formatting and initial log level.

Parameters
  • name (str) – Logger name.

  • level (int) – Logger initial message name.

  • fmt (Logger.Format) – Log entries formatting. By default FMT_DEFAULT.

DEF_FMT = Format(style='{', pattern='{created:.05f}: {name:<8s}: {levelname:<8s}: {module:<20s}: {message:s}')

Default entry format

class Format(style, pattern)

Bases: tuple

Logger entries format definition

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('style', 'pattern')
_fields_defaults = {}
classmethod _make(iterable)

Make a new Format object from a sequence or iterable

_replace(**kwds)

Return a new Format object replacing specified fields with new values

pattern

Alias for field number 1

style

Alias for field number 0

class Level(value)[source]

Bases: embutils.utils.enum.IntEnum

Available logger message levels.

CRITICAL = 50
DEBUG = 10
ERROR = 40
INFO = 20
WARNING = 30
disable() None[source]

Disable logger.

enable() None[source]

Enable logger.

set_level(level: embutils.utils.logger.Logger.Level = Level.DEBUG) None[source]

Set the log messages level.

Parameters

level (int) – Log level.

embutils.utils.logger.SDK_LOG = <Logger EMBUTILS (DEBUG)>

Embutils internal logger