Skip to content

logging

allennlp.common.logging

[SOURCE]


AllenNlpLogger

class AllenNlpLogger(logging.Logger):
 | def __init__(self, name)

A custom subclass of 'logging.Logger' that keeps a set of messages to implement {debug,info,etc.}_once() methods.

debug_once

class AllenNlpLogger(logging.Logger):
 | ...
 | def debug_once(self, msg, *args, **kwargs)

info_once

class AllenNlpLogger(logging.Logger):
 | ...
 | def info_once(self, msg, *args, **kwargs)

warning_once

class AllenNlpLogger(logging.Logger):
 | ...
 | def warning_once(self, msg, *args, **kwargs)

error_once

class AllenNlpLogger(logging.Logger):
 | ...
 | def error_once(self, msg, *args, **kwargs)

critical_once

class AllenNlpLogger(logging.Logger):
 | ...
 | def critical_once(self, msg, *args, **kwargs)

FILE_FRIENDLY_LOGGING

FILE_FRIENDLY_LOGGING: bool = False

If this flag is set to True, we add newlines to tqdm output, even on an interactive terminal, and we slow down tqdm's output to only once every 10 seconds.

By default, it is set to False.

ErrorFilter

class ErrorFilter(Filter)

Filters out everything that is at the ERROR level or higher. This is meant to be used with a stdout handler when a stderr handler is also configured. That way ERROR messages aren't duplicated.

filter

class ErrorFilter(Filter):
 | ...
 | def filter(self, record)

prepare_global_logging

def prepare_global_logging(
    serialization_dir: Union[str, PathLike],
    rank: int = 0,
    world_size: int = 1
) -> None