Skip to content
Snippets Groups Projects
Commit 7127b688 authored by Drew Devereux's avatar Drew Devereux
Browse files

Merge branch 'yan-688-log-at-error-level' into 'master'

YAN-688 Use different log levels depending on result code

See merge request ska-telescope/ska-tango-base!49
parents 48e2ea99 6f821caa
No related branches found
No related tags found
No related merge requests found
...@@ -174,6 +174,14 @@ class ResponseCommand(BaseCommand): ...@@ -174,6 +174,14 @@ class ResponseCommand(BaseCommand):
tuple. tuple.
""" """
RESULT_LOG_LEVEL = {
ResultCode.OK: logging.INFO,
ResultCode.STARTED: logging.INFO,
ResultCode.QUEUED: logging.INFO,
ResultCode.FAILED: logging.ERROR,
ResultCode.UNKNOWN: logging.WARNING
}
def __call__(self, argin=None): def __call__(self, argin=None):
""" """
What to do when the command is called. This base class simply What to do when the command is called. This base class simply
...@@ -208,7 +216,8 @@ class ResponseCommand(BaseCommand): ...@@ -208,7 +216,8 @@ class ResponseCommand(BaseCommand):
else: else:
(return_code, message) = self.do(argin=argin) (return_code, message) = self.do(argin=argin)
self.logger.info( self.logger.log(
self.RESULT_LOG_LEVEL.get(return_code, logging.ERROR),
f"Exiting command {self.name} with return_code {return_code!s}, " f"Exiting command {self.name} with return_code {return_code!s}, "
f"message: '{message}'" f"message: '{message}'"
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment