class Logging:
Wrapper class for the logging subsystem. This class wraps the initialization of the logging subsystem and provides convenience methods for printing log, error and warning messages to a logfile and to the console.
| Static Method | config |
Handle configuration update. |
| Static Method | console |
Print a message or object to the console. |
| Static Method | console |
Clear the console screen. |
| Static Method | console |
Read a line from the console. Catch EOF (^D) and Keyboard Interrup (^C). In that case None is returned. |
| Static Method | console |
Return and show a progress spinner and message while waiting for a block to complete. |
| Static Method | console |
Print a piece of code or data with syntax highlighting to the console. This function does not format the code. |
| Static Method | console |
Return the current console width. |
| Static Method | finit |
End logging. |
| Static Method | init |
Init the logging system. |
| Static Method | inspect |
Output a very comprehensive description of an object. |
| Static Method | log |
Print a log message with log-level INFO. |
| Static Method | log |
Print a log message with log-level DEBUG. |
| Static Method | log |
Add a divider line to the log. |
| Static Method | log |
Print a log message with log-level ERROR. |
| Static Method | logging |
Actor method to handle logging in the background. |
| Static Method | log |
Log request. |
| Static Method | log |
Print a log message with log-level WARNING. |
| Static Method | log |
Fallback log method when the level is a directly given argument. # TODO |
| Static Method | off |
Switch logging off. Remember the last logLevel |
| Static Method | on |
Switch logging on. Enable the last logLevel. |
| Static Method | queue |
Disable the logging queue. This can be used to get immediate feedback, e.g during startup. |
| Static Method | queue |
Enable the logging queue. Whether the usage of the queue really happens depends on the configured queue size. |
| Static Method | set |
Set the enableScreenLogging attribute via a method call. |
| Static Method | set |
Set a new log level to the logging system. |
| Static Method | stacktrace |
Output the current stacktrace to the log. |
| Class Variable | enable |
Flag to enable low-level logging in protocol bindings. |
| Class Variable | enable |
Flag to indicate whether file logging is enabled. |
| Class Variable | enable |
Flag to indicate whether the logging queue is enabled. Can be used to enable/disable the logging queue. |
| Class Variable | enable |
Flag to indicate whether screen logging is enabled. |
| Class Variable | filter |
List of log sources that will be filtered out. This is used to remove unwanted log messages from the output. |
| Class Variable | is |
Flag to indicate whether the log level is set to DEBUG. |
| Class Variable | is |
Flag to indicate whether the log level is set to INFO. |
| Class Variable | is |
Flag to indicate whether the log level is set to WARNING. |
| Class Variable | last |
The last log level that was set. This is used to determine whether the log level has changed. |
| Class Variable | logger |
The main logger for the logging subsystem. |
| Class Variable | logger |
The rich console logger for the logging subsystem. |
| Class Variable | max |
Maximum length of a log message. If the message is longer than this, it will be truncated. |
| Class Variable | queue |
The queue for the logging messages. This is used to handle the logging processing in the background. |
| Class Variable | queue |
The size of the logging queue. This is used to limit the number of log messages in the queue. |
| Class Variable | ring |
The ring buffer handler for the logging subsystem. This is used to store log messages in a ring buffer. |
| Class Variable | stack |
Flag to indicate whether to include stack traces in error logs. |
| Class Variable | table |
Style for the table row background. |
| Class Variable | terminal |
Style for the terminal text in dark mode. |
| Class Variable | terminal |
Style for the terminal error text. |
| Class Variable | terminal |
RGB tuple for the terminal text color. |
| Class Variable | utc |
Flag to indicate whether to use UTC time for logging. |
| Class Variable | worker |
The worker that handles the logging in the background. |
| Static Method | _configure |
Configure the colors for the terminal output based on the given theme. |
| Static Method | _log |
Internally adding various information to the log output. |
| Static Method | _log |
Log a message to the console logger. This is used to log messages to the console with the correct formatting. |
| Class Variable | _basenames |
Dictionary to store the basenames of the source files. This is used to optimize the log output. |
| Class Variable | _console |
The rich console object for the logging subsystem. |
| Class Variable | _event |
Event handler for logging errors. This is used to trigger an event when an error is logged. |
| Class Variable | _event |
Event handler for logging warnings. This is used to trigger an event when a warning is logged. |
| Class Variable | _handlers |
List of log handlers for the logging subsystem. This is used to store the log handlers for the logging subsystem. |
| Class Variable | _log |
The background worker for the logging subsystem. This is used to handle the logging in the background. |
| Class Variable | _rich |
The rich handler for the logging subsystem. This is used to format the log messages for the console. |
str | Text | Tree | Table | JSON = ' ', nl: bool | None = False, nlb: bool | None = False, end: str | None = '\n', plain: bool | None = False, isError: bool | None = False, isHeader: bool | None = False) -> str:
¶
Print a message or object to the console.
str, nl: bool | None = True, default: str | None = None) -> str:
¶
Read a line from the console. Catch EOF (^D) and Keyboard Interrup (^C). In that case None is returned.
Return and show a progress spinner and message while waiting for a block to complete.
Example
- with consoleStatusWait('waiting...'):
- . . .
| Parameters | |
msg:str | Message to display |
| Returns | |
Status | Status object. |
Print a piece of code or data with syntax highlighting to the console. This function does not format the code.
| Parameters | |
code:str | A string with formatted code or data. |
language:str | The language or type of data. |
Output a very comprehensive description of an object.
| Parameters | |
obj:Any | The object to inspect. |
immediate:bool | Immediately log the message, don't put it into the log queue. |
Print a log message with log-level INFO.
| Parameters | |
msg:Any | The log message. |
stackint | None | Optional offset for printing stacktraces. |
| Returns | |
str | Return the log msg again. |
Print a log message with log-level DEBUG.
| Parameters | |
msg:Any | The log message. |
stackint | None | Optional offset for printing stacktraces. |
| Returns | |
str | Return the log msg again. |
Add a divider line to the log.
| Parameters | |
level:int | None | Loglevel for the message. If None, the the current log level is taken |
message:str | None | Optional message that is centered on the line. |
Any, showStackTrace: bool | None = True, exc: Exception | None = None, stackOffset: int | None = 0) -> str:
¶
Print a log message with log-level ERROR.
| Parameters | |
msg:Any | The log message. |
showbool | None | Optional indicates whether a stacktrace shall be logged together with the error as well. |
exc:Exception | None | Optional exception to log. |
stackint | None | Optional offset for printing stacktraces. |
| Returns | |
str | Return the log msg again. |
Actor method to handle logging in the background.
| Returns | |
bool | True if the actor should continue running, False otherwise. |
Print a log message with log-level WARNING.
| Parameters | |
msg:Any | The log message. |
stackint | None | Optional offset for printing stacktraces. |
| Returns | |
str | Return the log msg again. |
int, msg: Any, showStackTrace: bool | None = False, stackOffset: int | None = 0) -> str:
¶
Fallback log method when the level is a directly given argument. # TODO
Enable the logging queue. Whether the usage of the queue really happens depends on the configured queue size.
Set the enableScreenLogging attribute via a method call.
| Parameters | |
value:bool | New value for enableScreenLogging. |
Output the current stacktrace to the log.
| Parameters | |
startint | None | Skip over a number of uninteresting frames at the beginning of the stack trace. The default is -10, meaning only log the last 10 stack frames. |
skipint | None | Number of stack frames to skip at the end of the stack trace. The default of 1 means to ignore the call to this logging function. |
Flag to indicate whether the logging queue is enabled. Can be used to enable/disable the logging queue.
List of log sources that will be filtered out. This is used to remove unwanted log messages from the output.
The queue for the logging messages. This is used to handle the logging processing in the background.
The ring buffer handler for the logging subsystem. This is used to store log messages in a ring buffer.
Configure the colors for the terminal output based on the given theme.
| Parameters | |
theme:str | The name of the theme to use. Supported values are 'dark' and 'light'. |
int, msg: Any, stackOffset: int | None = 0, immediate: bool | None = False) -> str:
¶
Internally adding various information to the log output.
The stackOffset is used to determine the correct caller. It is set by a calling method in case the log information are re-routed.
| Parameters | |
level:int | The log level. |
msg:Any | The log message. |
stackint | None | Optional offset in the stack frame. |
immediate:bool | None | Immediately log the message, don't put it into the log queue. |
| Returns | |
str | The log msg. |
int, msg: str, caller: inspect.Traceback, threadName: str):
¶
Log a message to the console logger. This is used to log messages to the console with the correct formatting.
| Parameters | |
level:int | The log level of the message. |
msg:str | The log message. |
caller:inspect.Traceback | The caller information from the stack frame. The caller information is used to determine the source file and line number of the log message. |
threadstr | The name of the current thread. |
Event handler for logging errors. This is used to trigger an event when an error is logged.
Event handler for logging warnings. This is used to trigger an event when a warning is logged.
List of log handlers for the logging subsystem. This is used to store the log handlers for the logging subsystem.
The background worker for the logging subsystem. This is used to handle the logging in the background.