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.
Nonefor not such a file.config – A MusicDB Configuration object that hold the ignore list. If
Nonethe 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
stderrand MusicDB gets exited with error code1.- Parameters
path (str) – Absolute path to a log file
- Returns
Trueon 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]->ignoreto 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.