def image(level, image): if image is None: return __init() if Config().curent_level().value < level.value: return if Config().curent_mode() == Mode.DEBUG: show_image(level.name, image) elif Config().curent_mode() == Mode.LOG: log_image(level.name, image)
def __rotate_log(self): if os.path.exists(self.__file_path()): if Config().rotate_log(): time_stamp = datetime.fromtimestamp( os.path.getctime( self.__file_path())).strftime("%y-%m-%d.%H%M%S") rename_path = os.path.join( Config().log_path(), 'cvlog_' + str(time_stamp) + '.html') os.rename(self.__file_path(), rename_path) else: self.__create_file()
def __rename_file_path(self): time_stamp = datetime.fromtimestamp( os.path.getctime(self.__file_path())).strftime("%y-%m-%d.%H%M%S") rename_path = os.path.join(Config().log_path(), 'cvlog_' + str(time_stamp) + '.html') if os.path.exists(rename_path): rename_path = os.path.join(Config().log_path(), 'cvlog_' + str(time_stamp) + '_01.html') if os.path.exists(rename_path): os.remove(rename_path) return rename_path
def image(level, image): if image is None: return try: __init() if Config().curent_level().value < level.value: return if Config().curent_mode() == Mode.DEBUG: show_image(level.name, image) elif Config().curent_mode() == Mode.LOG: log_image(level.name, image) except Exception as e: print(e)
def __init__(self): if not self.__initialised: self.__initialised = True report_path = os.path.join(Config().log_path(), "report") self.image_path = os.path.join(report_path, 'images') self.reporter = CsvReporter(os.path.join(report_path, "report.csv"))
def __init__(self, mode, level): self.html_logger = None self.mode = mode self.level = level if self.mode == Mode.LOG: self.html_logger = hl.HtmlLogger(Config().log_path() + f"/log_{int(time.time())}.html")
def __init(): global html_logger if Config().curent_mode() == Mode.LOG and html_logger is None: html_logger = hl.HtmlLogger()
def __file_path(self): return os.path.join(Config().log_path(), "cvlog.html")
def __init(): global html_logger if Config().curent_mode() == Mode.LOG and html_logger is None: html_logger = hl.HtmlLogger(Config().log_path() + "/log.html")
def __init__(self): if not self.__initialised: self.__initialised = True report_path = Config().log_path() + "/report" self.image_path = report_path + '/images/' self.reporter = CsvReporter(report_path + "/report.csv")
def __rotate_log(self): if Config().rotate_log() and os.path.exists(self.__file_path()): os.rename(self.__file_path(), self.__rename_file_path())