rofunc.utils.logger.beauty_logger#

1.  Module Contents#

1.1.  Classes#

BeautyLogger

Lightweight logger for Rofunc package.

1.2.  Functions#

beauty_print

Print the content with different colors.

1.3.  API#

class rofunc.utils.logger.beauty_logger.BeautyLogger(log_path: str, log_name: str = 'rofunc.log', verbose: bool = True)[source]#

Lightweight logger for Rofunc package.

Initialization

Lightweight logger for Rofunc package.

Example:

>>> from rofunc.utils.logger import BeautyLogger
>>> logger = BeautyLogger(log_path=".", log_name="rofunc.log", verbose=True)
Parameters:
  • log_path – the path for saving the log file

  • log_name – the name of the log file

  • verbose – whether to print the log to the console

warning(content, local_verbose=True)[source]#

Print the warning message.

Example:

>>> logger.warning("This is a warning message.")
Parameters:
  • content – the content of the warning message

  • local_verbose – whether to print the warning message to the console

Returns:

module(content, local_verbose=True)[source]#

Print the module message.

Example:

>>> logger.module("This is a module message.")
Parameters:
  • content – the content of the module message

  • local_verbose – whether to print the module message to the console

Returns:

info(content, local_verbose=True)[source]#

Print the module message.

Example:

>>> logger.info("This is a info message.")
Parameters:
  • content – the content of the info message

  • local_verbose – whether to print the info message to the console

Returns:

rofunc.utils.logger.beauty_logger.beauty_print(content, type=None)[source]#

Print the content with different colors.

Example:

>>> import rofunc as rf
>>> rf.logger.beauty_print("This is a warning message.", type="warning")
Parameters:
  • content – the content to be printed

  • type – support “warning”, “module”, “info”, “error”

Returns: