我的记录器的$variable = 63%
具有以下记录配置:
basicConfig
我得到的是:
import logging
log_path = "<my_path>"
file_name = "<my_file_name>"
logging.basicConfig(
level=args.loglvl,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler(f"{log_path}/{file_name}.log", mode='w'),
logging.StreamHandler()
]
)
现在,我想为要设置的变量添加自定义级别。例如:
2019-06-12 15:19:01,575 - root - DEBUG - <my_message>
因此,我想了解如何设置custom_thing = <my_custom_thing>
custom_yyyymmdd = <my_custom_date>
2019-06-12 15:19:01,575 - root - DEBUG - CUSTOM_THING - CUSTOM_YYYYMMDD - <my_message>
,asctime
,name
和levelname
变量,以及如何在{{ 1}}的自定义登录帐户。