1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-10 18:40:53 +00:00
This commit is contained in:
Corentin Le Bail 2011-02-16 13:53:27 +01:00
parent 8a86f57304
commit 50919133ac
6 changed files with 64 additions and 5 deletions

22
radicale/log.py Normal file
View file

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
import logging, sys
from radicale import config
class log:
def __init__(self):
self.logger=logging.getLogger("radicale")
self.logger.setLevel(config.get("logging", "facility"))
handler=logging.FileHandler(config.get("logging", "logfile"))
formatter = logging.Formatter('%(name)s %(asctime)s %(levelname)s %(message)s')
handler.setFormatter(formatter)
self.logger.addHandler(handler)
def log(self, level, msg):
self.logger.log(level, msg)
_LOGGING = log()
sys.modules[__name__] = _LOGGING