Logger#

class dpeeg.tools.Logger(logger: str = 'dpeeg_root', path: str | Path | None = None, mode: str = 'a', clevel: int | str = 20, flevel: int | str | None = None)[source]#

Logging hooks for terminals and file streams.

Can handle terminal printing and file writing in three situations: 1.Terminal print; 2.Terminal and file streams write simultaneously; 3.Ordinary file write.

Parameters:
  • logger (str) – Specify the logger name, creating it if necessary. If no name is specified, return the root logger.

  • path (str, optional) – The path of log file.

  • mode (str) – The write mode of the log file.

  • clevel (int, str) – The log level of console.

  • flevel (int, str, optional) – The log level of filehandler. If it is None, the log file will not be written and parameter path will be ignored.

update_sh_level(level: int | str)[source]#
get_sh_level() str[source]#
debug(message: str)[source]#
info(message: str)[source]#
warning(message: str)[source]#
error(message: str)[source]#
critical(message: str)[source]#
handle_exception(exc_type, exc_value, exc_traceback)[source]#