def __get_file_formatter():
"""Get logging formatter with Google logging like format.
Each line in the log should look like:
[DIWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] <message>
Returns:
Formatter object for use in logging handlers.
"""
# [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] <message>
ASCII_TIME_FORMAT = "%m%d %H:%M:%S" # mmdd hh:mm:ss.uuuuuu
LINE_FORMAT = ("%(levelname).1s" # [DIWEF]
"%(asctime)s.%(msecs)s " # ASCII_TIME_FORMAT
"%(threadName)s " # threadid
"%(pathname)s:%(lineno)d] " # file:line]
"%(message)s") # <message>
return logging.Formatter(fmt=LINE_FORMAT, datefmt=ASCII_TIME_FORMAT)
评论列表
文章目录