MCPcopy Create free account
hub / github.com/ehForwarderBot/ehForwarderBot / setup_logging

Function setup_logging

ehforwarderbot/__main__.py:189–207  ·  view source on GitHub ↗

Setup logging

(args, conf)

Source from the content-addressed store, hash-verified

187
188
189def setup_logging(args, conf):
190 """Setup logging"""
191 logging_format = "%(asctime)s [%(levelname)s]: %(name)s (%(module)s.%(funcName)s; " \
192 "%(filename)s:%(lineno)d)\n %(message)s"
193
194 if getattr(args, "verbose", None):
195 debug_logger = logging.StreamHandler(sys.stdout)
196 debug_logger.addFilter(LogLevelFilter(max_level=logging.WARNING))
197 debug_logger.setFormatter(logging.Formatter(logging_format))
198 logging.root.addHandler(debug_logger)
199 logging.root.level = logging.DEBUG
200
201 error_logger = logging.StreamHandler(sys.stderr)
202 error_logger.addFilter(LogLevelFilter(min_level=logging.ERROR))
203 error_logger.setFormatter(logging.Formatter(logging_format))
204 logging.root.addHandler(error_logger)
205
206 if conf['logging']:
207 logging.config.dictConfig(conf['logging'])
208
209
210CAPTURE_EXCEPTIONS = "I agree."

Callers 1

mainFunction · 0.85

Calls 1

LogLevelFilterClass · 0.85

Tested by

no test coverage detected