Logger¶
-
class
logger.
Logger
¶ Bases:
object
Provide an API for a logger for the program, which prints out logged messages to the terminal and saves the logged messages to a log file (if enabled in the ‘config.json’ and the file path is set).
-
LOG_FILE
= 'version_manager_{timestamp}.log'¶
-
LOG_MESSAGE_FORMAT
= '[{level}:{timestamp}:{tag}]: {message}'¶
-
class
LogLevel
¶ Bases:
enum.IntEnum
The possible log levels for log messages. The higher the value, the more serious the log message.
-
DEBUG
= 0¶
-
INFO
= 1¶
-
WARNING
= 2¶
-
ERROR
= 3¶
-
-
LogLevelsToStrings
= {<LogLevel.DEBUG: 0>: 'Debug', <LogLevel.INFO: 1>: 'Info', <LogLevel.WARNING: 2>: 'Warning', <LogLevel.ERROR: 3>: 'Error'}¶
-
StringsToLogLevels
= {'Debug': <LogLevel.DEBUG: 0>, 'Error': <LogLevel.ERROR: 3>, 'Info': <LogLevel.INFO: 1>, 'Warning': <LogLevel.WARNING: 2>}¶
-
time
= None¶
-
logLevel
= 0¶
-
static
Init
()¶
-
static
LogToFile
(message: str)¶ Log a given message to the log file path specified in the config.json.
Parameters: message (str) – The message to log to file.
-
static
Error
(tag: str, message: str)¶ Log an error message and, if enabled, log the error to a file.
Parameters: - tag (str) – The tag for the log message.
- message (str) – The message to log.
-
static
Warning
(tag: str, message: str)¶ Log a warning message and, if enabled, log the error to a file.
Parameters: - tag (str) – The tag for the log message.
- message (str) – The message to log.
-
static
Info
(tag: str, message: str)¶ Log an info message and, if enabled, log the error to a file.
Parameters: - tag (str) – The tag for the log message.
- message (str) – The message to log.
-
static
Debug
(tag: str, message: str)¶ Log a debug message and, if enabled, log the error to a file.
Parameters: - tag (str) – The tag for the log message.
- message (str) – The message to log.
-