logging

Consistent and configurable logging across graphnet.

class graphnet.utilities.logging.RepeatFilter[source]

Bases: Filter

Filter out repeat messages.

Construct RepeatFilter.

nb_repeats_allowed = 20
filter(record)[source]

Filter messages printed more than nb_repeats_allowed times.

Return type:

bool

Parameters:

record (LogRecord)

class graphnet.utilities.logging.Logger(name, class_name, level, log_folder, **kwargs)[source]

Bases: object

Class for handling logging across graphnet.

This class ensures that all logging is clear and intuitive, is done to the same file when using multiple workers, etc.

Composition, rather than inheritance from logging.LoggerAdapter is chosen to avoid clashing names of member variables/properties with e.g. pytorch_lightning.LightningModule.

Construct Logger.

Parameters:
  • name (str | None)

  • class_name (str | None)

  • level (int)

  • log_folder (str | None)

  • kwargs (Any)

setLevel(level)[source]

Delegate setLevel call to member logger.

Return type:

None

Parameters:

level (int)

critical(msg, *args, **kwargs)[source]

Delegate a critical call to member logger.

Return type:

None

Parameters:
  • msg (str)

  • args (Any)

  • kwargs (Any)

error(msg, *args, **kwargs)[source]

Delegate an error call to member logger.

Return type:

None

Parameters:
  • msg (str)

  • args (Any)

  • kwargs (Any)

warning(msg, *args, **kwargs)[source]

Delegate a warning call to member logger.

Return type:

None

Parameters:
  • msg (str)

  • args (Any)

  • kwargs (Any)

info(msg, *args, **kwargs)[source]

Delegate an info call to member logger.

Return type:

None

Parameters:
  • msg (str)

  • args (Any)

  • kwargs (Any)

debug(msg, *args, **kwargs)[source]

Delegate a debug call to member logger.

Return type:

None

Parameters:
  • msg (str)

  • args (Any)

  • kwargs (Any)

warning_once(msg)[source]

Print msg as warning exactly once.

Return type:

None

Parameters:

msg (str)

property handlers: List[Handler]

Return list of handlers for base Logger.

property file_handlers: List[FileHandler]

Return list of FileHandler`s for base `Logger.

property stream_handlers: List[StreamHandler]

Return list of StreamHandler`s for base `Logger.