Exemplo n.º 1
0
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)
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
 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"))
Exemplo n.º 6
0
 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")
Exemplo n.º 7
0
def __init():
    global html_logger
    if Config().curent_mode() == Mode.LOG and html_logger is None:
        html_logger = hl.HtmlLogger()
Exemplo n.º 8
0
 def __file_path(self):
     return os.path.join(Config().log_path(), "cvlog.html")
Exemplo n.º 9
0
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")
Exemplo n.º 10
0
 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")
Exemplo n.º 11
0
 def __rotate_log(self):
     if Config().rotate_log() and os.path.exists(self.__file_path()):
         os.rename(self.__file_path(), self.__rename_file_path())