Adding TRACE level to VOLTHA logs
Change-Id: Ieaaa707cadf2c17842ce8595bded444bce69ec57
diff --git a/common/structlog_setup.py b/common/structlog_setup.py
index cbbda89..828c439 100644
--- a/common/structlog_setup.py
+++ b/common/structlog_setup.py
@@ -79,6 +79,14 @@
logging.config.dictConfig(log_config)
logging.root.level -= 10 * verbosity_adjust
+ # Add TRACE log level (lower than DEBUG:10)
+ TRACE_LOGLVL = 5
+ logging.addLevelName(TRACE_LOGLVL, "TRACE")
+ def trace_loglevel(self, message, *args, **kws):
+ if self.isEnabledFor(TRACE_LOGLVL):
+ self._log(TRACE_LOGLVL, message, args, **kws)
+ logging.Logger.trace = trace_loglevel
+
processors = [
add_exc_info_flag_for_exception,
structlog.processors.StackInfoRenderer(),
@@ -96,7 +104,6 @@
log.info("first-line")
return log
-
def update_logging(instance_id, vcore_id):
"""
Add the vcore id to the structured logger
diff --git a/voltha/core/global_handler.py b/voltha/core/global_handler.py
index 098e145..f6e728a 100644
--- a/voltha/core/global_handler.py
+++ b/voltha/core/global_handler.py
@@ -159,12 +159,12 @@
@twisted_async
@inlineCallbacks
def ListLogicalDevices(self, request, context):
- log.debug('grpc-request', request=request)
+ log.trace('grpc-request', request=request)
response = yield self.dispatcher.dispatch('ListLogicalDevices',
Empty(),
context,
broadcast=True)
- log.debug('grpc-response', response=response)
+ log.trace('grpc-response', response=response)
returnValue(response)
@twisted_async
@@ -190,13 +190,13 @@
@twisted_async
@inlineCallbacks
def ListLogicalDevicePorts(self, request, context):
- log.debug('grpc-request', request=request)
+ log.trace('grpc-request', request=request)
response = yield self.dispatcher.dispatch('ListLogicalDevicePorts',
request,
context,
id=request.id)
- log.debug('grpc-response', response=response)
+ log.trace('grpc-response', response=response)
if isinstance(response, DispatchError):
log.warn('grpc-error-response', error=response.error_code)
context.set_details(
@@ -204,7 +204,7 @@
context.set_code(response.error_code)
returnValue(Ports())
else:
- log.debug('grpc-success-response', response=response)
+ log.trace('grpc-success-response', response=response)
returnValue(response)
@twisted_async
@@ -476,19 +476,19 @@
@twisted_async
@inlineCallbacks
def ListDevicePorts(self, request, context):
- log.debug('grpc-request', request=request)
+ log.trace('grpc-request', request=request)
response = yield self.dispatcher.dispatch('ListDevicePorts',
request,
context,
id=request.id)
- log.debug('grpc-response', response=response)
+ log.trace('grpc-response', response=response)
if isinstance(response, DispatchError):
log.warn('grpc-error-response', error=response.error_code)
context.set_details('Device \'{}\' error'.format(request.id))
context.set_code(response.error_code)
returnValue(Ports())
else:
- log.debug('grpc-success-response', response=response)
+ log.trace('grpc-success-response', response=response)
returnValue(response)
@twisted_async
diff --git a/voltha/core/local_handler.py b/voltha/core/local_handler.py
index 2a2df05..4fc7ab8 100644
--- a/voltha/core/local_handler.py
+++ b/voltha/core/local_handler.py
@@ -135,7 +135,7 @@
@twisted_async
def ListLogicalDevices(self, request, context):
- log.debug('grpc-request', request=request)
+ log.trace('grpc-request', request=request)
items = self.root.get('/logical_devices')
return LogicalDevices(items=items)
@@ -161,7 +161,7 @@
@twisted_async
def ListLogicalDevicePorts(self, request, context):
- log.debug('grpc-request', request=request)
+ log.trace('grpc-request', request=request)
if '/' in request.id:
context.set_details(
@@ -725,7 +725,7 @@
@twisted_async
def ListDevicePorts(self, request, context):
- log.debug('grpc-request', request=request)
+ log.trace('grpc-request', request=request)
if '/' in request.id:
context.set_details(