modifié: m/log.py

This commit is contained in:
sidya82 2014-03-03 13:13:00 +01:00
parent 801d7c64db
commit 23ff16a575

View File

@ -7,12 +7,17 @@ class Log(object):
def __init__(self) :
self.logger = logging.getLogger()
self.logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
formatter = logging.Formatter('%(asctime)-15s :: %(levelname)s :: %(message)s')
file_handler = RotatingFileHandler('activity.log', 'a', 1000000, 1)
file_handler.setLevel(logging.DEBUG)
file_handler.setFormatter(formatter)
self.logger.addHandler(file_handler)
file_handler_error = RotatingFileHandler('error.log', 'a', 1000000, 1)
file_handler_error.setLevel(logging.ERROR)
file_handler_error.setFormatter(formatter)
self.logger.addHandler(file_handler_error)
def enregDansLog(self,pLog,pMsg,pIP):
with open("fichier/log", "a") as dest :
d = datetime.now().strftime("%c")