Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions harness/libraries/rgt_loggers/rgt_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging
import time
import os
import inspect

class rgt_logger:

Expand Down Expand Up @@ -73,29 +74,42 @@ def get_fh_threshold_level(self):
def get_ch_threshold_level(self):
return self.__ch_threshold_level

def getLocation(self, message):
if message != "" and self.get_logger_threshold_level() == "DEBUG":
loc=""
stack = inspect.stack()
# Step up stack until we are out of the logging bits
i = 2
while stack[i][3] == stack[1][3] and i < len(stack):
i += 1
loc = "In function " + stack[i][3] + ": " + message
return loc
else:
return message

def doDebugLogging(self,
message):
self.__myLogger.debug(message)
self.__myLogger.debug(self.getLocation(message))
return

def doInfoLogging(self,
message):
self.__myLogger.info(message)
self.__myLogger.info(self.getLocation(message))
return

def doWarningLogging(self,
message):
self.__myLogger.warning(message)
self.__myLogger.warning(self.getLocation(message))
return

def doErrorLogging(self,
message):
self.__myLogger.error(message)
self.__myLogger.error(self.getLocation(message))
return

def doCriticalLogging(self,
message):
self.__myLogger.critical(message)
self.__myLogger.critical(self.getLocation(message))

# Private methods
def _add_file_handler(self):
Expand Down