flame.core.logging#

Module Contents#

Classes#

TqdmHandler

Handler instances dispatch logging events to specific destinations.

Functions#

remove_all_handlers([name])

create_console_handler([fmt, datefmt])

create_file_handler(filename[, fmt])

logging_except_hook(exc_type, exc_value, traceback)

https://stackoverflow.com/questions/6234405/logging-uncaught-exceptions-in-python

set_logging_except_hook()

init_logging([filename, debug, force])

log_runtime_env()

From @huww98/hutils

log_code_version()

Borrow from @huww98/hutils, thx

Attributes#

_logger

FILE_FORMAT

CONSOLE_FORMAT

CONSOLE_DATE_FORMAT

flame.core.logging._logger#
flame.core.logging.FILE_FORMAT = %(asctime)s|%(levelname)-8s|%(message)s#
flame.core.logging.CONSOLE_FORMAT = %(asctime)s|%(levelname)-8s|%(message)s#
flame.core.logging.CONSOLE_DATE_FORMAT = %Y-%m-%d %H:%M:%S#
class flame.core.logging.TqdmHandler(level=logging.NOTSET)#

Bases: logging.Handler

Handler instances dispatch logging events to specific destinations.

The base handler class. Acts as a placeholder which defines the Handler interface. Handlers can optionally use Formatter instances to format records as desired. By default, no formatter is specified; in this case, the ‘raw’ message as determined by record.message is logged.

emit(record)#

Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.

Parameters:

record (logging.LogRecord) –

Return type:

None

flame.core.logging.remove_all_handlers(name=None)#
Parameters:

name (Optional[str]) –

flame.core.logging.create_console_handler(fmt=CONSOLE_FORMAT, datefmt=CONSOLE_DATE_FORMAT)#
Parameters:
  • fmt (str) –

  • datefmt (str) –

flame.core.logging.create_file_handler(filename, fmt=FILE_FORMAT)#
Parameters:
  • filename (str) –

  • fmt (str) –

flame.core.logging.logging_except_hook(exc_type, exc_value, traceback)#

https://stackoverflow.com/questions/6234405/logging-uncaught-exceptions-in-python

flame.core.logging.set_logging_except_hook()#
flame.core.logging.init_logging(filename=None, debug=False, force=True)#
Parameters:
  • filename (Optional[str]) –

  • debug (bool) –

  • force (bool) –

flame.core.logging.log_runtime_env()#

From @huww98/hutils

flame.core.logging.log_code_version()#

Borrow from @huww98/hutils, thx