Core: Add timestamps to logging for seed generation (#3028)
* Add timestamps to logging for improved debugging * Add datetime to general logging; particularly useful for large seeds. * Move console timestamps from Main to Utils.init_logging (better location) * Update Main.py remove spurious blank line Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com> --------- Co-authored-by: Zach Parks <zach@alliware.com> Co-authored-by: Nicholas Saylor <79181893+nicholassaylor@users.noreply.github.com>
This commit is contained in:
parent
1371c63a8d
commit
91185f4f7c
3
Utils.py
3
Utils.py
|
@ -515,10 +515,13 @@ def init_logging(name: str, loglevel: typing.Union[str, int] = logging.INFO, wri
|
|||
return self.condition(record)
|
||||
|
||||
file_handler.addFilter(Filter("NoStream", lambda record: not getattr(record, "NoFile", False)))
|
||||
file_handler.addFilter(Filter("NoCarriageReturn", lambda record: '\r' not in record.msg))
|
||||
root_logger.addHandler(file_handler)
|
||||
if sys.stdout:
|
||||
formatter = logging.Formatter(fmt='[%(asctime)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
||||
stream_handler = logging.StreamHandler(sys.stdout)
|
||||
stream_handler.addFilter(Filter("NoFile", lambda record: not getattr(record, "NoStream", False)))
|
||||
stream_handler.setFormatter(formatter)
|
||||
root_logger.addHandler(stream_handler)
|
||||
|
||||
# Relay unhandled exceptions to logger.
|
||||
|
|
Loading…
Reference in New Issue