Python logging.info(extra)

import logging

FORMAT = '%(asctime)s %(clientip)s %(user)-8s %(message)s %(haiyoushui)s'

logging.basicConfig(format=FORMAT)

d={'clientip':'192.168.0.1','user':'fbloggs', "haiyoushui":"12312313113213"}

logger=logging.getLogger('tcpserver')

logger.warning('Protocolproblem:%s','connectionreset',extra=d)

 

posted @ 2021-02-25 20:12  Black_Climber  阅读(376)  评论(0编辑  收藏  举报