Spaces:
Sleeping
Sleeping
# -*- coding: utf-8 -*- | |
import logging | |
def setup_logging(): | |
logging.basicConfig( | |
format="%(asctime)s %(module)s %(levelname)s : %(message)s", level=logging.INFO | |
) | |
# -*- coding: utf-8 -*- | |
def verbose(value, thresh=1, ignore: list = [], **outputs): | |
"""Verbose outputs. | |
Parameters | |
---------- | |
value : int | |
An integer showing the verbose level of an output. Higher verbose value means less important. | |
If the object's or script's initialized verbose threshold is equal to or lower than this value, it will print. | |
thresh : int | |
ignore : list | |
A list of outout types to ignore. (Debug, Warning, Error, etc.) | |
**outputs : kword arguments, 'key'='value' | |
Outputs with keys. Keys will be also printed. More than one key and output pair can be supplied. | |
""" | |
for output in outputs.items(): | |
if output[0] not in ignore: | |
if value <= thresh: | |
print("\n> " + str(output[0]) + ":", output[1]) | |
# event_log.append([str(datetime.now())+'\n> '+str(output[0])+':',output[1]]) | |