Skip to content

Commit d34ce59

Browse files
committed
Modify logging.
Change to explicitly make the default logging level be WARNING.
1 parent 8b63e25 commit d34ce59

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

popper/util.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,16 @@ def flatten(xs):
256256

257257

258258
class Settings:
259+
260+
showcons: bool
261+
datalog: bool
262+
show_failures: bool # display detailed FP and FN information
263+
259264
def __init__(self, cmd_line=False, info=True, debug=False, show_stats=True, max_literals=MAX_LITERALS,
260265
timeout=TIMEOUT, quiet=False, eval_timeout=EVAL_TIMEOUT, max_examples=MAX_EXAMPLES, max_body=None,
261266
max_rules=None, max_vars=None, functional_test=False, kbpath=False, ex_file=False, bk_file=False,
262267
bias_file=False, showcons=False, no_bias=False, order_space=False, noisy=False, batch_size=BATCH_SIZE,
263-
solver='rc2', anytime_solver=None, anytime_timeout=ANYTIME_TIMEOUT):
268+
solver='rc2', anytime_solver=None, anytime_timeout=ANYTIME_TIMEOUT, show_failures=False):
264269

265270
if cmd_line:
266271
args = parse_args()
@@ -299,14 +304,15 @@ def __init__(self, cmd_line=False, info=True, debug=False, show_stats=True, max_
299304
self.logger = logging.getLogger("popper")
300305

301306
if quiet:
302-
pass
307+
log_level = logging.ERROR
303308
elif debug:
304309
log_level = logging.DEBUG
305310
# logging.basicConfig(format='%(asctime)s %(message)s', level=log_level, datefmt='%H:%M:%S')
306311
logging.basicConfig(format='%(message)s', level=log_level, datefmt='%H:%M:%S')
307312
elif info:
308313
log_level = logging.INFO
309-
logging.basicConfig(format='%(asctime)s %(message)s', level=log_level, datefmt='%H:%M:%S')
314+
else:
315+
log_level = logging.WARNING
310316

311317
self.info = info
312318
self.debug = debug
@@ -516,9 +522,9 @@ def print_incomplete_solution2(self, prog, tp, fn, tn, fp, size):
516522
self.logger.info(format_rule(self.order_rule(rule)))
517523
self.logger.info('*' * 20)
518524

519-
def print_prog_score(self, prog, score):
525+
def print_prog_score(self, prog, score: Tuple[int, int, int, int, int]) -> None:
520526
tp, fn, tn, fp, size = score
521-
precision = 'n/a'
527+
precision: str = 'n/a'
522528
if (tp + fp) > 0:
523529
precision = f'{tp / (tp + fp):0.2f}'
524530
recall = 'n/a'

0 commit comments

Comments
 (0)