allennlp.common.tee_logger

A logger that maintains logs of both stdout and stderr when models are run.

class allennlp.common.tee_logger.TeeLogger(filename: str, terminal: typing.TextIO) → None[source]

Bases: object

This class is an attempt to maintain logs of both stdout and stderr for when models are run. To use this class, at the beginning of your script insert these lines:

sys.stdout = TeeLogger("stdout.log", sys.stdout)
sys.stderr = TeeLogger("stdout.log", sys.stderr)
flush()[source]
write(message)[source]

Writes a message to the log.