Permalink
Switch branches/tags
Nothing to show
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)