nautical.log package

Submodules

nautical.log.log module

class nautical.log.log.NauticalLogFormatter(fmt=None, datefmt=None, style='%', validate=True)[source]

Bases: Formatter

Formatter class that will be used for formatting nautical information. The formatter will add color as well as an image

FORMATS = {10: '\x1b[34;20m[🌊 %(levelname)s]: %(message)s\x1b[0m', 20: '\x1b[32;20m[🌊 %(levelname)s]: %(message)s\x1b[0m', 30: '\x1b[33;20m[🌊 %(levelname)s]: %(message)s\x1b[0m', 40: '\x1b[31;20m[🌊 %(levelname)s]: %(message)s\x1b[0m', 50: '\x1b[35;20m[🌊 %(levelname)s]: %(message)s\x1b[0m'}
blue = '\x1b[34;20m'
fmt = '[🌊 %(levelname)s]: %(message)s'
format(record)[source]

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.

green = '\x1b[32;20m'
purple = '\x1b[35;20m'
red = '\x1b[31;20m'
reset = '\x1b[0m'
yellow = '\x1b[33;20m'
nautical.log.log.get_logger(name='nautical', verbosity=10)[source]

Wrap the logging.getLogger functionality to apply nautical based logging information.

Parameters
  • name – Name of the logger

  • verbosity – Level of verbosity for the logger

Returns

logging.log formatted with the NauticalLogFormatter

Module contents

nautical.log.get_logger(name='nautical', verbosity=10)[source]

Wrap the logging.getLogger functionality to apply nautical based logging information.

Parameters
  • name – Name of the logger

  • verbosity – Level of verbosity for the logger

Returns

logging.log formatted with the NauticalLogFormatter