modifié: m/log.py
modifié: superTornado.py
This commit is contained in:
parent
23ff16a575
commit
6c1b97396a
16
m/log.py
16
m/log.py
@ -6,6 +6,7 @@ from datetime import datetime
|
|||||||
class Log(object):
|
class Log(object):
|
||||||
def __init__(self) :
|
def __init__(self) :
|
||||||
self.logger = logging.getLogger()
|
self.logger = logging.getLogger()
|
||||||
|
self.logger = addLevelName(25, SUCESS)
|
||||||
self.logger.setLevel(logging.DEBUG)
|
self.logger.setLevel(logging.DEBUG)
|
||||||
formatter = logging.Formatter('%(asctime)-15s :: %(levelname)s :: %(message)s')
|
formatter = logging.Formatter('%(asctime)-15s :: %(levelname)s :: %(message)s')
|
||||||
file_handler = RotatingFileHandler('activity.log', 'a', 1000000, 1)
|
file_handler = RotatingFileHandler('activity.log', 'a', 1000000, 1)
|
||||||
@ -30,6 +31,8 @@ class Log(object):
|
|||||||
print bcolors.DEBUG,
|
print bcolors.DEBUG,
|
||||||
elif pLvl == 20 :
|
elif pLvl == 20 :
|
||||||
print bcolors.INFO,
|
print bcolors.INFO,
|
||||||
|
elif pLvl == 25 :
|
||||||
|
print bcolors.SUCCESS,
|
||||||
elif pLvl == 30 :
|
elif pLvl == 30 :
|
||||||
print bcolors.WARNING,
|
print bcolors.WARNING,
|
||||||
elif pLvl == 40 :
|
elif pLvl == 40 :
|
||||||
@ -38,20 +41,13 @@ class Log(object):
|
|||||||
print bcolors.ENDC,
|
print bcolors.ENDC,
|
||||||
|
|
||||||
class bcolors:
|
class bcolors:
|
||||||
NOTSET = '\033[95m'
|
DEBUG = '\033[95m'
|
||||||
DEBUG = '\033[94m'
|
INFO = '\033[94m'
|
||||||
INFO = '\033[92m'
|
SUCCESS = '\033[92m'
|
||||||
WARNING = '\033[93m'
|
WARNING = '\033[93m'
|
||||||
FAIL = '\033[91m'
|
FAIL = '\033[91m'
|
||||||
ENDC = '\033[0m'
|
ENDC = '\033[0m'
|
||||||
|
|
||||||
def disable(self):
|
|
||||||
self.HEADER = ''
|
|
||||||
self.OKBLUE = ''
|
|
||||||
self.OKGREEN = ''
|
|
||||||
self.WARNING = ''
|
|
||||||
self.FAIL = ''
|
|
||||||
self.ENDC = ''
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,9 +170,9 @@ if __name__ == "__main__":
|
|||||||
raise ConfigError("Failed Load Port Server Configuration")
|
raise ConfigError("Failed Load Port Server Configuration")
|
||||||
except ConfigError as e :
|
except ConfigError as e :
|
||||||
log.printL(e.value, 40)
|
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)
|
sys.exit(1)
|
||||||
print log.printL("->Configuration Server Load Successfully :", 20)
|
print log.printL("->Configuration Server Load Successfully :", 25)
|
||||||
if blind == True:
|
if blind == True:
|
||||||
log.printL(" ->Blind unhabitant", 20)
|
log.printL(" ->Blind unhabitant", 20)
|
||||||
else :
|
else :
|
||||||
@ -185,7 +185,7 @@ if __name__ == "__main__":
|
|||||||
log.printL("->Server Start ...",20)
|
log.printL("->Server Start ...",20)
|
||||||
http_server = tornado.httpserver.HTTPServer(application)
|
http_server = tornado.httpserver.HTTPServer(application)
|
||||||
http_server.listen(portServ)
|
http_server.listen(portServ)
|
||||||
log.printL("->Server Start Successfully !",20)
|
log.printL("->Server Start Successfully !",25)
|
||||||
tornado.ioloop.IOLoop.instance().start()
|
tornado.ioloop.IOLoop.instance().start()
|
||||||
except Exception, e :
|
except Exception, e :
|
||||||
log.printL("Server Start Failed !",40)
|
log.printL("Server Start Failed !",40)
|
||||||
|
Reference in New Issue
Block a user