Add timestamps to the log file

This commit is contained in:
Eren Dogan 2023-10-05 14:55:05 -07:00
parent 6a6ac026db
commit fe379297be
1 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@
# #
import sys import sys
import os import os
import datetime
import pdb import pdb
import inspect import inspect
from openram import globals from openram import globals
@ -62,6 +63,9 @@ def print_raw(str):
def log(str): def log(str):
# Add timestamp at the beginning of the string
timestr = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
str = "[{}] {}".format(timestr, str)
if globals.OPTS.output_name != '': if globals.OPTS.output_name != '':
if log.create_file: if log.create_file:
# We may have not yet read the config, so we need to ensure # We may have not yet read the config, so we need to ensure