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 *
|
||||
|
||||
LOGGER = logging.getLogger()
|
||||
|
||||
class ThreadState(Enum):
|
||||
IDLE = 0
|
||||
|
@ -60,9 +59,9 @@ class restResponse():
|
|||
return self.msg
|
||||
|
||||
if response in {ogResponses.OK, ogResponses.IN_PROGRESS}:
|
||||
LOGGER.debug(self.msg[:ogRest.LOG_LENGTH])
|
||||
logging.debug(self.msg[:ogRest.LOG_LENGTH])
|
||||
else:
|
||||
LOGGER.warn(self.msg[:ogRest.LOG_LENGTH])
|
||||
logging.warn(self.msg[:ogRest.LOG_LENGTH])
|
||||
|
||||
self.msg += '\r\n'
|
||||
|
||||
|
@ -281,14 +280,14 @@ class ogRest():
|
|||
method = request.get_method()
|
||||
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
|
||||
not "reboot" in URI and
|
||||
not "poweroff" in URI and
|
||||
not "probe" in URI):
|
||||
if self.state == ThreadState.BUSY:
|
||||
LOGGER.warn('Request has been received '
|
||||
logging.warn('Request has been received '
|
||||
'while ogClient is busy')
|
||||
response = restResponse(ogResponses.SERVICE_UNAVAILABLE)
|
||||
client.send(response.get())
|
||||
|
@ -306,7 +305,7 @@ class ogRest():
|
|||
elif "refresh" in URI:
|
||||
self.process_refresh(client)
|
||||
else:
|
||||
LOGGER.warn('Unsupported request: %s',
|
||||
logging.warn('Unsupported request: %s',
|
||||
{URI[:ogRest.LOG_LENGTH]})
|
||||
response = restResponse(ogResponses.BAD_REQUEST)
|
||||
client.send(response.get())
|
||||
|
@ -331,7 +330,7 @@ class ogRest():
|
|||
elif ("image/create" in URI):
|
||||
self.process_imagecreate(client, request)
|
||||
else:
|
||||
LOGGER.warn('Unsupported request: %s',
|
||||
logging.warn('Unsupported request: %s',
|
||||
URI[:ogRest.LOG_LENGTH])
|
||||
response = restResponse(ogResponses.BAD_REQUEST)
|
||||
client.send(response.get())
|
||||
|
|
Loading…
Reference in New Issue