nvflare.fuel.utils.log_utils module

class ANSIColor[source]

Bases: object

BOLD_RED = '31;1'
CYAN = '36'
GREY = '38'
RED = '31'
RESET = '0'
YELLOW = '33'
class BaseFormatter(fmt='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt=None, style='%')[source]

Bases: Formatter

BaseFormatter is the default formatter for log records.

Shortens logger %(name)s to the suffix, full name can be accessed with %(fullName)s

Parameters:
  • fmt – format string which uses LogRecord attributes.

  • datefmt – date/time format string. Defaults to ‘%Y-%m-%d %H:%M:%S’.

  • style – style character ‘%’ ‘{’ or ‘$’ for format string.

format(record)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

add_log_file_handler(log_file_name)[source]
ansi_sgr(code)[source]
configure_logging(workspace: Workspace)[source]
get_module_logger(module=None, name=None)[source]
get_obj_logger(obj)[source]
get_script_logger()[source]
print_logger_hierarchy(package_name='nvflare', level_colors={'CRITICAL': '31;1', 'DEBUG': '38', 'ERROR': '31', 'INFO': '38', 'WARNING': '33'})[source]