msl.qt.widgets.logger module¶
A QWidget
to display logging
messages.
- class msl.qt.widgets.logger.Logger(*, level=20, fmt='%(asctime)s [%(levelname)s] -- %(name)s -- %(message)s', datefmt=None, logger=None, parent=None)[source]¶
-
A
QWidget
to displaylogging
messages.- Parameters:
level (
int
orstr
, optional) – The Logging Level to use to display theLogRecord
.fmt (
str
, optional) – The LogRecord attributes to use to display theLogRecord
.datefmt (
str
orNone
, optional) – The strftime format to use for the time stamp. IfNone
then theISO8601
date format is used,YYYY-mm-dd HH:MM:SS,sss
.logger (
logging.Logger
, optional) – Thelogging.Logger
to add thislogging.Handler
to. IfNone
the uses the rootlogging.Logger
.parent (
QtWidgets.QWidget
, optional) – The parent widget.
Example
To view an example of the
Logger
widget run:>>> from msl.examples.qt import logger >>> logger.show()
- save(path, *, level=20)[source]¶
Save log records to a file.
- Parameters:
path (
str
) – The path to save the log records to. Appends the records to the file if the file already exists, otherwise creates a new log file. It is recommended that the file extension be.log
, but not mandatory.level (
int
, optional) – AllLogRecord
’s with a Logging Level >= level will be saved.