logger

Importing log from this module starts a logging handler, which can be logged to with log.info(“log this info”) etc.

class MyCoolFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

See https://jupyterbook.org/en/stable/content/code-outputs.html#ansi-outputs for colors. E.g. below: 30 gives black font (and 1;30 would give bold-black font) 41 gives red background.

format(record)

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

adjust_logger(log_write, folder, log_level, testing=False)

Function to adjust the default logging settings that get initiated by importing this module.

Parameters
  • log_write (bool) – Stop or start writing to log.

  • folder (str) – Path to folder in which to store “log.txt”.

  • log_level (str) – Set the log level.