pain001.context package#

Submodules#

pain001.context.context module#

class pain001.context.context.Context[source]#

Bases: object

A class that can be used to manage logging.

__init__(self)[source]#

Initializes the class and creates a logger.

get_instance()[source]#

Returns the singleton instance of the class.

get_logger(self)[source]#

Returns the logger.

init_logger(self)[source]#

Initializes the logger.

set_log_level(self, log_level)[source]#

Sets the log level of the logger.

set_name(self, name)[source]#

Sets the name of the logger.

static get_instance() Context[source]#

Returns the singleton instance of the class.

Returns:

A Context instance.

get_logger() Logger[source]#

Returns the logger.

Returns:

A Logger instance.

init_logger() None[source]#

Initializes the logger.

Raises:

RuntimeError – If the logger has already been initialized.

instance: Context | None = None#
set_log_level(log_level: int) None[source]#

Sets the log level of the logger.

Parameters:

log_level – The log level of the logger.

Raises:

ValueError – If the log level is invalid.

set_name(name: str) None[source]#

Sets the name of the logger.

Parameters:

name – The name of the logger.

Module contents#