gpf_entrepot_toolbelt.utils.gpf_logger module

Logueur pour la GPF.

class gpf_entrepot_toolbelt.utils.gpf_logger.GPFFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)

Bases : Formatter

Formatteur spécifique des logs pour l’API Entrepôt de la Géoplateforme.

Paramètres:

logging (logging.Formatter) – formatteur de logger

format(record: LogRecord) LogRecord
Définit le format des messages de log à appliquer selon le niveau de

l’enregistrement à journaliser.

Paramètres:

record (logging.LogRecord) – enregistrement à formater

Renvoie:

enregistrement formaté

Type renvoyé:

logging.LogRecord

gpf_entrepot_toolbelt.utils.gpf_logger.add_logging_level(levelName, levelNum, methodName=None)

Ajoute un niveau de log personnalisé au module de journalisation (logging).

levelName becomes an attribute of the logging module with the value levelNum. methodName becomes a convenience method for both logging itself and the class returned by logging.getLoggerClass() (usually just logging.Logger). If methodName is not specified, levelName.lower() is used.

To avoid accidental clobberings of existing attributes, this method will raise an AttributeError if the level name is already an attribute of the logging module or if the method name is already present

From <https://stackoverflow.com/a/35804945>.

Exemple

>>> addLoggingLevel('TRACE', logging.DEBUG - 5)
>>> logging.getLogger(__name__).setLevel("TRACE")
>>> logging.getLogger(__name__).trace('that worked')
>>> logging.trace('so did this')
>>> logging.TRACE
5
gpf_entrepot_toolbelt.utils.gpf_logger.gpf_logger_script(verbosity: int, title: str) Logger

Crée et retourne un logueur pour la GPF.

Paramètres:
  • verbosity (int) – niveau de verbosité du logueur.

  • title (str) – titre du logueur.

Renvoie:

logueur configuré

Type renvoyé:

logging.Logger