modifié: m/log.py
modifié: superTornado.py
This commit is contained in:
parent
60c072dc46
commit
bbfd0e5b8d
8
m/log.py
8
m/log.py
@ -13,8 +13,7 @@ class lvl:
|
||||
NOTSET = 0
|
||||
DEBUG = 10
|
||||
INFO = 20
|
||||
SUCCESS = 21
|
||||
ILLEGAL = 25
|
||||
SUCCESS = 25
|
||||
WARNING = 30
|
||||
FAIL = 40
|
||||
|
||||
@ -33,7 +32,6 @@ class Log(object):
|
||||
def __init__(self) :
|
||||
|
||||
logging.addLevelName(lvl.SUCCESS, "SUCCESS")
|
||||
logging.addLevelName(lvl.ILLEGAL, "ILLEGAL")
|
||||
|
||||
self.logger = logging.getLogger()
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
@ -45,9 +43,9 @@ class Log(object):
|
||||
self.logger.addHandler(file_handler)
|
||||
|
||||
file_handler_warning = RotatingFileHandler('illegal.log', 'a', 1000000, 1)
|
||||
f1 = SingleLevelFilter(logging.ILLEGAL, False)
|
||||
f1 = SingleLevelFilter(logging.WARNING, False)
|
||||
file_handler_warning.addFilter(f1)
|
||||
file_handler.setFormatter(formatter)
|
||||
file_handler_warning.setFormatter(formatter)
|
||||
self.logger.addHandler(file_handler_warning)
|
||||
|
||||
file_handler_error = RotatingFileHandler('error.log', 'a', 1000000, 1)
|
||||
|
@ -25,6 +25,7 @@ ipCamera = ""
|
||||
portCamera = ""
|
||||
portServ =""
|
||||
log = Log()
|
||||
urlCamera=""
|
||||
|
||||
|
||||
class BaseHandler(tornado.web.RequestHandler):
|
||||
@ -173,6 +174,14 @@ if __name__ == "__main__":
|
||||
log.printL(" +Port Server : " + portServ,lvl.INFO)
|
||||
print ""
|
||||
|
||||
urlCamera = 'http://test:a@'+ipCamera+':'+portCamera+'/image.jpg?cidx=791836195''
|
||||
try :
|
||||
f = urlopen(urlCamera)
|
||||
log.printL( "->Camera OK ", lvl.SUCCESS)
|
||||
except Exception, e :
|
||||
log.printL("->Camera Unreachable! Check Camera Configuration!",lvl.ERROR)
|
||||
|
||||
|
||||
try :
|
||||
log.printL("->Server Start ...",lvl.INFO)
|
||||
tornado.options.parse_command_line()
|
||||
|
Reference in New Issue
Block a user