Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (13 sloc) 483 Bytes
import logging
from logging import FileHandler, StreamHandler
default_formatter = logging.Formatter(\
"%(asctime)s:%(levelname)s:%(message)s")
console_handler = StreamHandler()
console_handler.setFormatter(default_formatter)
error_handler = FileHandler("error.log", "a")
error_handler.setLevel(logging.ERROR)
error_handler.setFormatter(default_formatter)
root = logging.getLogger()
root.addHandler(console_handler)
root.addHandler(error_handler)
root.setLevel(logging.DEBUG)
You can’t perform that action at this time.