def _setup_logging(self, args, default_log_level):
fmt = '%(asctime)s [%(thread)d] %(levelname)-5s %(name)s %(message)s'
formatter = Formatter(fmt=fmt, datefmt='%Y-%m-%dT%H:%M:%S ')
stream = stdout if args.log_stream_stdout else stderr
handler = StreamHandler(stream=stream)
handler.setFormatter(formatter)
logger = getLogger()
logger.addHandler(handler)
if args.log_syslog:
fmt = 'octodns[%(process)-5s:%(thread)d]: %(name)s ' \
'%(levelname)-5s %(message)s'
handler = SysLogHandler(address=args.syslog_device,
facility=args.syslog_facility)
handler.setFormatter(Formatter(fmt=fmt))
logger.addHandler(handler)
logger.level = DEBUG if args.debug else default_log_level
# boto is noisy, set it to warn
getLogger('botocore').level = WARN
# DynectSession is noisy too
getLogger('DynectSession').level = WARN
评论列表
文章目录