logging

New in version 0.40.0.

logging Module

ooodev.io.log.logging.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

ooodev.io.log.logging.add_stream_handler()[source]

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

Return type:

None

ooodev.io.log.logging.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

ooodev.io.log.logging.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

ooodev.io.log.logging.debugs(*messages)[source]

Log Several messages debug formatted by tab.

Parameters:

messages (Any) – One or more messages to log.

Return type:

None

ooodev.io.log.logging.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

ooodev.io.log.logging.exception(msg, *args, **kwargs)[source]

Logs exception 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

ooodev.io.log.logging.get_log_level()[source]

Get the log level.

Returns:

The log level.

Return type:

int

ooodev.io.log.logging.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

ooodev.io.log.logging.infos(*messages)[source]

Log Several messages info formatted by tab.

Parameters:

messages (Any) – One or more messages to log.

Return type:

None

ooodev.io.log.logging.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

ooodev.io.log.logging.remove_handlers()[source]

Remove all handlers from the logger.

Return type:

None

ooodev.io.log.logging.reset_logger()[source]

Reset the logger instance.

ooodev.io.log.logging.save_log(path, data)[source]

Save data in file, data append to end and automatic add current time.

Parameters:
  • path (Any) – PathLike path such a string or Path to save log.

  • data (Any) – Data to save in file log

Returns:

True if success, False otherwise

Return type:

bool

ooodev.io.log.logging.set_log_level(level)[source]

Set the log level.

Parameters:

level (int) – The log level.

Return type:

None

ooodev.io.log.logging.warning(msg, *args, **kwargs)[source]

Logs warning 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