summaryrefslogtreecommitdiffstats
path: root/src/ogRest.py
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-03-09 15:14:01 +0100
committerJose M. Guisado <jguisado@soleta.eu>2023-03-10 11:26:46 +0100
commit5b5ef607eca3e5f72b597f75dae7e415ce117a9f (patch)
treefed3ac72372950f7c787f55c484b21d053317526 /src/ogRest.py
parentb58ccca48b6cecf357dbccc2ef744d1ea7c01939 (diff)
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 logger
Diffstat (limited to 'src/ogRest.py')
-rw-r--r--src/ogRest.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ogRest.py b/src/ogRest.py
index 02d3d0c..69620e6 100644
--- a/src/ogRest.py
+++ b/src/ogRest.py
@@ -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())