cpl_core.logging package

Submodules

cpl_core.logging.logger_abc module

class cpl_core.logging.logger_abc.LoggerABC

Bases: ABC

ABC for cpl_core.logging.logger_service.Logger

abstract debug(name: str, message: str)

Writes a debug message

Parameter:
name: str

Message name

message: str

Message string

abstract error(name: str, message: str, ex: Exception | None = None)

Writes an error

Parameter:
name: str

Error name

message: str

Error message

ex: Exception

Thrown exception

abstract fatal(name: str, message: str, ex: Exception | None = None)

Writes an error and ends the program

Parameter:
name: str

Error name

message: str

Error message

ex: Exception

Thrown exception

abstract header(string: str)

Writes a header message

Parameter:
string: str

String to write as header

abstract info(name: str, message: str)

Writes an information

Parameter:
name: str

Message name

message: str

Message string

abstract trace(name: str, message: str)

Writes a trace message

Parameter:
name: str

Message name

message: str

Message string

abstract warn(name: str, message: str)

Writes an warning

Parameter:
name: str

Message name

message: str

Message string

cpl_core.logging.logger_service module

class cpl_core.logging.logger_service.Logger(logging_settings: LoggingSettings, time_format: TimeFormatSettings, env: ApplicationEnvironmentABC)

Bases: LoggerABC

Service for logging

Parameter:
logging_settings: cpl_core.logging.logging_settings.LoggingSettings

Settings for the logger

time_format: cpl_core.time.time_format_settings.TimeFormatSettings

Time format settings

env: cpl_core.environment.application_environment_abc.ApplicationEnvironmentABC

Environment of the application

create() None

Creates path tree and logfile

debug(name: str, message: str)

Writes a debug message

Parameter:
name: str

Message name

message: str

Message string

error(name: str, message: str, ex: Exception | None = None)

Writes an error

Parameter:
name: str

Error name

message: str

Error message

ex: Exception

Thrown exception

fatal(name: str, message: str, ex: Exception | None = None)

Writes an error and ends the program

Parameter:
name: str

Error name

message: str

Error message

ex: Exception

Thrown exception

header(string: str)

Writes a header message

Parameter:
string: str

String to write as header

info(name: str, message: str)

Writes an information

Parameter:
name: str

Message name

message: str

Message string

trace(name: str, message: str)

Writes a trace message

Parameter:
name: str

Message name

message: str

Message string

warn(name: str, message: str)

Writes an warning

Parameter:
name: str

Message name

message: str

Message string

cpl_core.logging.logging_level_enum module

class cpl_core.logging.logging_level_enum.LoggingLevelEnum(value)

Bases: Enum

An enumeration.

DEBUG = 5
ERROR = 2
FATAL = 1
INFO = 4
OFF = 0
TRACE = 6
WARN = 3

cpl_core.logging.logging_settings module

class cpl_core.logging.logging_settings.LoggingSettings(path: str | None = None, filename: str | None = None, console_log_level: LoggingLevelEnum | None = None, file_log_level: LoggingLevelEnum | None = None)

Bases: ConfigurationModelABC

Representation of logging settings

property console: LoggingLevelEnum
property filename: str
property level: LoggingLevelEnum
property path: str

cpl_core.logging.logging_settings_name_enum module

class cpl_core.logging.logging_settings_name_enum.LoggingSettingsNameEnum(value)

Bases: Enum

An enumeration.

console_level = 'ConsoleLogLevel'
file_level = 'FileLogLevel'
filename = 'Filename'
path = 'Path'

Module contents

cpl-core CPL core

CPL core package

copyright:
  1. 2020 - 2023 sh-edraft.de

license:

MIT, see LICENSE for more details.

class cpl_core.logging.VersionInfo(major, minor, micro)

Bases: tuple

major

Alias for field number 0

micro

Alias for field number 2

minor

Alias for field number 1