MusicDB Logging

This library provides the excessive logging system of MusicDB.

For details about the file and directory structure for logging information into files see MusicDB Data Files and Directories.

MusicDBLogger Class

class musicdb.lib.logging.MusicDBLogger[source]

This class provides the logging management itself and handles the logging configuration.

Reconfigure(logpath='stderr', loglevelname='DEBUG', debugpath=None, config=None)[source]

This method allows to reconfigure the setting for the MusicDB logger.

Parameters
  • path (str) – A “path” where the logs will be written. Use "stdout" or "stderr" to show them on the screen. Use "journal" to write to SystemDs journal.

  • loglevelname (str) – Name of the lowest log level that shall be shown: "DEBUG", "INFO", "WARNING", "ERROR" or "CRITICAL".

  • debugpath (str) – Path to a file where everything (DEBUG) shall be logged in. None for not such a file.

  • config – A MusicDB Configuration object that hold the ignore list. If None the configuration will not be appied.

Returns

nothing

SetFilePermissions(path)[source]

This method set the access permission of a file to “rw-rw—-“. If the file in path cannot be accessed, an error gets printed to stderr and MusicDB gets exited with error code 1.

Parameters

path (str) – Absolute path to a log file

Returns

True on success. On Error MusicDB gets terminated.

class musicdb.lib.logging.MDBLogFormatter(ignorelist)[source]

This class handles log messages. The class is derived from logging.Formatter.

It sets the loglevel of the modules listed in configuration under [log]->ignore to WARNING.

Furthermore this class defines how the log entries will look like.

Parameters

ignorelist – List of module names that shall not appear in the logs

format(record)[source]

Overloads the format method of logging.Formatter to apply coloring and add additional information to the messages.