This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# logger.info('This is an info message') | |
# Logger().info() --> ._log() 然后 -> .makeRecord() # makeRecord 生成LogRecord对象,就是一条日志记录的对象 | |
# 然后调用 Logger().handle(record) ---> .callHandlers(record) 里面循环执行 hdlr.handle(record), 这个hdlr 就是MidnightRotatingFileHandler对象, | |
# 找MidnightRotatingFileHandler的 父类 handle方法的实现,一直找到Handler类里的下面这个 | |
# def handle(self, record): | |
# """ | |
# Conditionally emit the specified logging record. | |
# Emission depends on filters which may have been added to the handler. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from logging.handlers import TimedRotatingFileHandler | |
from flask import Flask | |
# f_formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(filename)s - %(message)s') | |
fmt = '%(asctime)s - %(levelname)s - %(filename)s - %(message)s' | |
f_handler = TimedRotatingFileHandler('app.log', when='s', interval=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def creat_images_path(video_path, img_path): # aa/ | |
carID_folder_list = os.listdir(video_path) | |
for carid in carID_folder_list: | |
carid_path = os.path.join(video_path, carid) # aa/123 aa/456 | |
rootdir_folder_list = os.listdir(carid_path) | |
rootdir_folder_list.sort() | |
for camdir in rootdir_folder_list: | |
if camdir in cam_dict: | |
file_count = 0 | |
dirpath = carid_path + '/' + camdir |