Introduction

Scope

This simple library has 2 goals:

  • Logging formatter

  • LogWrapper definition (basic class with logger property definition)

Log formatting

Logs will have the following format:

<time> [<log_name>][<custom_names>][<levelname>] <message>

Where:

  • time: the current time. Example:

    • 2021-09-23 12:53:55,651

  • log_name: the name passed as argument, that is usually the __name__ attribute of the module. Examples:

    • batch.db

    • data_extraction.country.py.dncp.parser.cp_release

  • custom_names: (optional) these are tags that can be added to customize the logs and give useful information

    • for example, in public contracting, the OCID of the contracting process can be added as a custom tag, in order to have all logs of that OCID linked to it.

  • levelname: this is the level of the log. Levels in the logging library are:

    • CRITICAL (& FATAL)

    • ERROR

    • WARNING (& WARN)

    • INFO

    • DEBUG

    • NOTSET

  • message: the message to be logged