mirror of https://github.com/VLSIDA/OpenRAM.git
fixed -v logging
This commit is contained in:
parent
36d8d98b17
commit
e890c0e188
|
|
@ -16,7 +16,7 @@ def check(check, str):
|
||||||
index) = inspect.getouterframes(inspect.currentframe())[1]
|
index) = inspect.getouterframes(inspect.currentframe())[1]
|
||||||
sys.stderr.write("ERROR: file {0}: line {1}: {2}\n".format(
|
sys.stderr.write("ERROR: file {0}: line {1}: {2}\n".format(
|
||||||
os.path.basename(filename), line_number, str))
|
os.path.basename(filename), line_number, str))
|
||||||
log("ERROR: file {0}: line {1}: {2}\n".format(
|
logger.log("ERROR: file {0}: line {1}: {2}\n".format(
|
||||||
os.path.basename(filename), line_number, str))
|
os.path.basename(filename), line_number, str))
|
||||||
|
|
||||||
assert 0
|
assert 0
|
||||||
|
|
@ -27,7 +27,7 @@ def error(str, return_value=0):
|
||||||
index) = inspect.getouterframes(inspect.currentframe())[1]
|
index) = inspect.getouterframes(inspect.currentframe())[1]
|
||||||
sys.stderr.write("ERROR: file {0}: line {1}: {2}\n".format(
|
sys.stderr.write("ERROR: file {0}: line {1}: {2}\n".format(
|
||||||
os.path.basename(filename), line_number, str))
|
os.path.basename(filename), line_number, str))
|
||||||
log("ERROR: file {0}: line {1}: {2}\n".format(
|
logger.log("ERROR: file {0}: line {1}: {2}\n".format(
|
||||||
os.path.basename(filename), line_number, str))
|
os.path.basename(filename), line_number, str))
|
||||||
|
|
||||||
assert return_value == 0
|
assert return_value == 0
|
||||||
|
|
@ -38,7 +38,7 @@ def warning(str):
|
||||||
index) = inspect.getouterframes(inspect.currentframe())[1]
|
index) = inspect.getouterframes(inspect.currentframe())[1]
|
||||||
sys.stderr.write("WARNING: file {0}: line {1}: {2}\n".format(
|
sys.stderr.write("WARNING: file {0}: line {1}: {2}\n".format(
|
||||||
os.path.basename(filename), line_number, str))
|
os.path.basename(filename), line_number, str))
|
||||||
log("WARNING: file {0}: line {1}: {2}\n".format(
|
logger.log("WARNING: file {0}: line {1}: {2}\n".format(
|
||||||
os.path.basename(filename), line_number, str))
|
os.path.basename(filename), line_number, str))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -48,17 +48,27 @@ def print_raw(str):
|
||||||
|
|
||||||
|
|
||||||
def log(str):
|
def log(str):
|
||||||
if log.create_file:
|
if globals.OPTS.output_name != '':
|
||||||
compile_log = open(globals.OPTS.output_path +
|
if log.create_file:
|
||||||
globals.OPTS.output_name + '.log', "w")
|
compile_log = open(globals.OPTS.output_path +
|
||||||
log.create_file = 0
|
globals.OPTS.output_name + '.log', "w+")
|
||||||
|
log.create_file = 0
|
||||||
|
else:
|
||||||
|
compile_log = open(globals.OPTS.output_path +
|
||||||
|
globals.OPTS.output_name + '.log', "a")
|
||||||
|
|
||||||
|
if len(log.setup_output) != 0:
|
||||||
|
for line in log.setup_output:
|
||||||
|
compile_log.write(line)
|
||||||
|
log.setup_output = []
|
||||||
|
compile_log.write(str + '\n')
|
||||||
else:
|
else:
|
||||||
compile_log = open(globals.OPTS.output_path +
|
log.setup_output.append(str + "\n")
|
||||||
globals.OPTS.output_name + '.log', "a")
|
|
||||||
compile_log.write(str + '\n')
|
|
||||||
log.create_file = 1
|
|
||||||
|
|
||||||
|
|
||||||
|
# use a static list of strings to store messages until the global paths are set up
|
||||||
|
log.setup_output = []
|
||||||
|
log.create_file = 1
|
||||||
|
|
||||||
|
|
||||||
def info(lev, str):
|
def info(lev, str):
|
||||||
|
|
@ -71,5 +81,5 @@ def info(lev, str):
|
||||||
class_name = ""
|
class_name = ""
|
||||||
else:
|
else:
|
||||||
class_name = mod.__name__
|
class_name = mod.__name__
|
||||||
print_raw("[{0}/{1}]: {2}".format(class_name, frm[0].f_code.co_name, str))
|
print_raw("[{0}/{1}]: {2}".format(class_name,
|
||||||
|
frm[0].f_code.co_name, str))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue