fenn.logging

Inheritance diagram of fenn.logging
class fenn.logging.FennHandler(level=0)[source]

Bases: XmlMixin, Handler

Parameters:

level (int)

__init__(level=0)[source]
Parameters:

level (int)

Return type:

None

configure(args, started_at)[source]
Parameters:
  • args (dict[str, Any])

  • started_at (PlainDateTime)

Return type:

None

emit(record)[source]

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 (LogRecord)

Return type:

None

class fenn.logging.FennLogger(logger, handler)[source]

Bases: XmlMixin, LoggerAdapter

Parameters:
__init__(logger, handler)[source]
Parameters:
Return type:

None

close()[source]
Return type:

None

fn_file: Path
handler: FennHandler
log_metric(name, value, step)[source]

Appends a structured <metric> entry to the run’s .fn file.

name accepts any string and is persisted as-is (e.g. “train_loss”, “val_loss”, “acc” - the values fenn’s built-in trainers emit).

Parameters:
  • name (str)

  • value (float)

  • step (int)

Return type:

None

process(msg, kwargs)[source]

Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.

Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.

Parameters:
  • msg (str)

  • kwargs (MutableMapping[str, Any])

Return type:

tuple[str, MutableMapping[str, Any]]

txt_file: Path
write_config(args, config_file)[source]
Parameters:
  • args (dict[str, Any])

  • config_file (Path)

Return type:

None

class fenn.logging.XmlMixin[source]

Bases: object

fn_file: Path
fenn.logging.redirect_prints()[source]
Return type:

None

fenn.logging.restore_prints()[source]
Return type:

None