HTML Log Generator¶
-
class
logboss.generators.html_generator.HtmlLogGenerator(logs: Dict)¶ Bases:
objectGenerates an HTML log file from the given logs. The logs must derive from the logger in the format returned by
Logger.get_logs().-
generate(log_file: Union[str, pathlib.Path], title: str = 'Log Results', include_code: bool = False, datetime_range: Tuple[datetime.datetime, datetime.datetime] = None, exclude_files: List[str] = None)¶ Generates an HTML log file from the logs persisted by the logger.
If using a compiling tool such as PyInstaller,
include_codemust beFalse. Also, there is more overhead when including the code snippets associated to the log events. Each log event is associated to a file; each file is imported in HTML format as an iframe to the overall output.- Parameters
log_file – Absolute path to the SQLite DB log file.
title – Title of the log file. Default is “Log File”.
include_code – If
Truethe include iframes of the source code of the files associated to the log entries.datetime_range – Defines the start and/or end date parameters of the log data included in the output file. This is always a
Tupleof size 2 where the first item is the start date and the second is the end date. If only a start or end date is desired, then set the other value toNone. Date should bedatetimeobjects.exclude_files – A list of regular expressions for files that should NOT be included in the code blocks. If
include_codeisTrue, then the code files are included in the output so the code can be referenced directly by the logs. This parameter can be used to improve security and space. It is recommended to exclude files that may leak sensitive information and are highly unlikely to provide much use to the log file.
-