crumpets.logging module

class crumpets.logging.JSONLogger(name, filename, level=0)[source]

Bases: logging.Logger

A subclass of the default Python Logger that uses the JSONLines output format.

critical(**kwargs)[source]

Log ‘msg % args’ with severity ‘CRITICAL’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.critical(“Houston, we have a %s”, “major disaster”, exc_info=1)

debug(**kwargs)[source]

Log ‘msg % args’ with severity ‘DEBUG’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.debug(“Houston, we have a %s”, “thorny problem”, exc_info=1)

error(**kwargs)[source]

Log ‘msg % args’ with severity ‘ERROR’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.error(“Houston, we have a %s”, “major problem”, exc_info=1)

exception(exc_info=True, **kwargs)[source]

Convenience method for logging an ERROR with exception information.

fatal(**kwargs)

Log ‘msg % args’ with severity ‘CRITICAL’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.critical(“Houston, we have a %s”, “major disaster”, exc_info=1)

info(**kwargs)[source]

Log ‘msg % args’ with severity ‘INFO’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.info(“Houston, we have a %s”, “interesting problem”, exc_info=1)

log(level, **kwargs)[source]

Log ‘msg % args’ with the integer severity ‘level’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.log(level, “We have a %s”, “mysterious problem”, exc_info=1)

warning(**kwargs)[source]

Log ‘msg % args’ with severity ‘WARNING’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.warning(“Houston, we have a %s”, “bit of a problem”, exc_info=1)

class crumpets.logging.ProgressPrinter(*_, **__)[source]

Bases: tqdm.std.tqdm

class crumpets.logging.SilentLogger[source]

Bases: object

Replacement logger for a logger that does not log anything. Useful when running multiple processes, but not all of them should log results.

critical(**kwargs)[source]
debug(**kwargs)[source]
error(**kwargs)[source]
exception(exc_info=True, **kwargs)[source]
fatal(**kwargs)
info(**kwargs)[source]
log(level, **kwargs)[source]
warning(**kwargs)[source]
crumpets.logging.get_logfilename(prefix='', dateformat='%Y-%m-%dt%H-%M-%S', pathformat='%s%s.log')[source]
crumpets.logging.make_printer(bar_format='{desc} {percentage:3.0f}% {elapsed}<{remaining}, {rate_fmt}{postfix}', miniters=0, mininterval=0.5, smoothing=0.1, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, **kwargs)[source]

Create a ProgressPrinter with appropriate parameters for training. See tqdm documentation for details on parameters. :return:

crumpets.logging.print(*args)[source]

Overwrites the builtin print function with tqdm.tqdm.write, so things are printed properly while tqdm is active. :param args: :return: