modifié: m/log.py

modifié:         superTornado.py
This commit is contained in:
sidya82 2014-03-03 13:20:16 +01:00
parent 23ff16a575
commit 6c1b97396a
2 changed files with 9 additions and 13 deletions

View File

@ -6,6 +6,7 @@ from datetime import datetime
class Log(object):
def __init__(self) :
self.logger = logging.getLogger()
self.logger = addLevelName(25, SUCESS)
self.logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)-15s :: %(levelname)s :: %(message)s')
file_handler = RotatingFileHandler('activity.log', 'a', 1000000, 1)
@ -30,6 +31,8 @@ class Log(object):
print bcolors.DEBUG,
elif pLvl == 20 :
print bcolors.INFO,
elif pLvl == 25 :
print bcolors.SUCCESS,
elif pLvl == 30 :
print bcolors.WARNING,
elif pLvl == 40 :
@ -38,20 +41,13 @@ class Log(object):
print bcolors.ENDC,
class bcolors:
NOTSET = '\033[95m'
DEBUG = '\033[94m'
INFO = '\033[92m'
DEBUG = '\033[95m'
INFO = '\033[94m'
SUCCESS = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def disable(self):
self.HEADER = ''
self.OKBLUE = ''
self.OKGREEN = ''
self.WARNING = ''
self.FAIL = ''
self.ENDC = ''

View File

@ -170,9 +170,9 @@ if __name__ == "__main__":
raise ConfigError("Failed Load Port Server Configuration")
except ConfigError as e :
log.printL(e.value, 40)
log.printL("Configuration Loading Failed ! Check Configuration File !")
log.printL("Configuration Loading Failed ! Check Configuration File !", 40)
sys.exit(1)
print log.printL("->Configuration Server Load Successfully :", 20)
print log.printL("->Configuration Server Load Successfully :", 25)
if blind == True:
log.printL(" ->Blind unhabitant", 20)
else :
@ -185,7 +185,7 @@ if __name__ == "__main__":
log.printL("->Server Start ...",20)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(portServ)
log.printL("->Server Start Successfully !",20)
log.printL("->Server Start Successfully !",25)
tornado.ioloop.IOLoop.instance().start()
except Exception, e :
log.printL("Server Start Failed !",40)