Class NamedLogger

class ooodev.io.log.named_logger.NamedLogger(name)[source]

Class for Logging class messages

Parameters:

name (str) –

__init__(name)[source]

Constructor

Parameters:

name (str) – Name of the class.

Return type:

None

add_file_logger(log_file, log_level=-1)[source]

Add a file logger to the logger if it does not already exist.

Parameters:
  • log_file (PathOrStr) – Log File Path.

  • log_level (int, optional) – Log Level. Defaults to Instance Log Level.

Returns:

True if the handler was added, False otherwise.

Return type:

bool

add_stream_handler()[source]

Adds a stream handler to the logger if it does not already exist.

Return type:

None

critical(msg, *args, **kwargs)[source]

Logs critical message.

Parameters:
  • msg (Any) – message to debug.

  • args (Any, optional) – arguments.

  • kwargs (Any) –

Keyword Arguments:
  • exc_info – (_ExcInfoType): Exc Info Type Default to None

  • stack_info (bool) – Stack Info. Defaults to False.

  • stacklevel (int) – Stack Level. Defaults to 1.

  • extra (Mapping[str, object], None) – extra Defaults to None.

Return type:

None

Returns:

None

debug(msg, *args, **kwargs)[source]

Logs debug message.

Parameters:
  • msg (Any) – message to debug.

  • args (Any, optional) – arguments.

  • kwargs (Any) –

Keyword Arguments:
  • exc_info – (_ExcInfoType): Exc Info Type Default to None

  • stack_info (bool) – Stack Info. Defaults to False.

  • stacklevel (int) – Stack Level. Defaults to 1.

  • extra (Mapping[str, object], None) – extra Defaults to None.

Return type:

None

Returns:

None

debugs(*messages)[source]

Show messages debug

Parameters:

messages (list[Any]) – List of messages to debug

Return type:

None

error(msg, *args, **kwargs)[source]

Logs error message.

Parameters:
  • msg (Any) – message to debug.

  • args (Any, optional) – arguments.

  • kwargs (Any) –

Keyword Arguments:
  • exc_info – (_ExcInfoType): Exc Info Type Default to None

  • stack_info (bool) – Stack Info. Defaults to False.

  • stacklevel (int) – Stack Level. Defaults to 1.

  • extra (Mapping[str, object], None) – extra Defaults to None.

Return type:

None

Returns:

None

exception(msg, *args, **kwargs)[source]

Logs error message.

Parameters:
  • msg (Any) – message to debug.

  • args (Any, optional) – arguments.

  • kwargs (Any) –

Keyword Arguments:
  • exc_info – (_ExcInfoType): Exc Info Type Default to True

  • stack_info (bool) – Stack Info. Defaults to False.

  • stacklevel (int) – Stack Level. Defaults to 1.

  • extra (Mapping[str, object], None) – extra Defaults to None.

Return type:

None

Returns:

None

info(msg, *args, **kwargs)[source]

Logs info message.

Parameters:
  • msg (Any) – message to debug.

  • args (Any, optional) – arguments.

  • kwargs (Any) –

Keyword Arguments:
  • exc_info – (_ExcInfoType): Exc Info Type Default to None

  • stack_info (bool) – Stack Info. Defaults to False.

  • stacklevel (int) – Stack Level. Defaults to 1.

  • extra (Mapping[str, object], None) – extra Defaults to None.

Return type:

None

Returns:

None

remove_file_logger(log_file)[source]

Remove a file logger from the logger if it exists.

Parameters:

log_file (PathOrStr) – Log File Path.

Returns:

True if the handler was removed, False otherwise.

Return type:

bool

remove_handlers()[source]

Remove all handlers from the logger.

Return type:

None

warning(msg, *args, **kwargs)[source]

Logs info message.

Parameters:
  • msg (Any) – message to debug.

  • args (Any, optional) – arguments.

  • kwargs (Any) –

Keyword Arguments:
  • exc_info – (_ExcInfoType): Exc Info Type Default to None

  • stack_info (bool) – Stack Info. Defaults to False.

  • stacklevel (int) – Stack Level. Defaults to 1.

  • extra (Mapping[str, object], None) – extra Defaults to None.

Return type:

None

Returns:

None

property is_debug: bool

Check if is debug

Return type:

bool

property is_error: bool

Check if is error

Return type:

bool

property is_info: bool

Check if is info

Return type:

bool

property is_warning: bool

Check if is warning

Return type:

bool