mirror of https://git.48k.eu/ogclient
ogRest: remove root logger constant
Remove unnecesary root logger constant: LOGGER The root logger is used by default when executing: logging.debug() logging.info() logging.warning() ... There is no point in doing: LOGGER = logging.getLogger() # Get root logger LOGGER.debug() # Use root loggermore_events
parent
b58ccca48b
commit
5b5ef607ec
|
@ -20,7 +20,6 @@ from logging.handlers import SysLogHandler
|
||||||
|
|
||||||
from src.restRequest import *
|
from src.restRequest import *
|
||||||
|
|
||||||
LOGGER = logging.getLogger()
|
|
||||||
|
|
||||||
class ThreadState(Enum):
|
class ThreadState(Enum):
|
||||||
IDLE = 0
|
IDLE = 0
|
||||||
|
@ -60,9 +59,9 @@ class restResponse():
|
||||||
return self.msg
|
return self.msg
|
||||||
|
|
||||||
if response in {ogResponses.OK, ogResponses.IN_PROGRESS}:
|
if response in {ogResponses.OK, ogResponses.IN_PROGRESS}:
|
||||||
LOGGER.debug(self.msg[:ogRest.LOG_LENGTH])
|
logging.debug(self.msg[:ogRest.LOG_LENGTH])
|
||||||
else:
|
else:
|
||||||
LOGGER.warn(self.msg[:ogRest.LOG_LENGTH])
|
logging.warn(self.msg[:ogRest.LOG_LENGTH])
|
||||||
|
|
||||||
self.msg += '\r\n'
|
self.msg += '\r\n'
|
||||||
|
|
||||||
|
@ -281,14 +280,14 @@ class ogRest():
|
||||||
method = request.get_method()
|
method = request.get_method()
|
||||||
URI = request.get_uri()
|
URI = request.get_uri()
|
||||||
|
|
||||||
LOGGER.debug('Incoming request: %s%s', method, URI[:ogRest.LOG_LENGTH])
|
logging.debug('Incoming request: %s%s', method, URI[:ogRest.LOG_LENGTH])
|
||||||
|
|
||||||
if (not "stop" in URI and
|
if (not "stop" in URI and
|
||||||
not "reboot" in URI and
|
not "reboot" in URI and
|
||||||
not "poweroff" in URI and
|
not "poweroff" in URI and
|
||||||
not "probe" in URI):
|
not "probe" in URI):
|
||||||
if self.state == ThreadState.BUSY:
|
if self.state == ThreadState.BUSY:
|
||||||
LOGGER.warn('Request has been received '
|
logging.warn('Request has been received '
|
||||||
'while ogClient is busy')
|
'while ogClient is busy')
|
||||||
response = restResponse(ogResponses.SERVICE_UNAVAILABLE)
|
response = restResponse(ogResponses.SERVICE_UNAVAILABLE)
|
||||||
client.send(response.get())
|
client.send(response.get())
|
||||||
|
@ -306,7 +305,7 @@ class ogRest():
|
||||||
elif "refresh" in URI:
|
elif "refresh" in URI:
|
||||||
self.process_refresh(client)
|
self.process_refresh(client)
|
||||||
else:
|
else:
|
||||||
LOGGER.warn('Unsupported request: %s',
|
logging.warn('Unsupported request: %s',
|
||||||
{URI[:ogRest.LOG_LENGTH]})
|
{URI[:ogRest.LOG_LENGTH]})
|
||||||
response = restResponse(ogResponses.BAD_REQUEST)
|
response = restResponse(ogResponses.BAD_REQUEST)
|
||||||
client.send(response.get())
|
client.send(response.get())
|
||||||
|
@ -331,7 +330,7 @@ class ogRest():
|
||||||
elif ("image/create" in URI):
|
elif ("image/create" in URI):
|
||||||
self.process_imagecreate(client, request)
|
self.process_imagecreate(client, request)
|
||||||
else:
|
else:
|
||||||
LOGGER.warn('Unsupported request: %s',
|
logging.warn('Unsupported request: %s',
|
||||||
URI[:ogRest.LOG_LENGTH])
|
URI[:ogRest.LOG_LENGTH])
|
||||||
response = restResponse(ogResponses.BAD_REQUEST)
|
response = restResponse(ogResponses.BAD_REQUEST)
|
||||||
client.send(response.get())
|
client.send(response.get())
|
||||||
|
|
Loading…
Reference in New Issue