You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do this by first creating the htf.Test() object, getting its uid, getting the logger for that uid, then proxying logs into that logger like so:
classPassAlongHandler(logging.Handler):
def__init__(self, handler):
self._handler=handlersuper(PassAlongHandler, self).__init__()
defhandle(self, record):
self._handler.handle(record)
defProxyLogger(src, dest):
src.handlers= [PassAlongHandler(dest)]
defmy_setup_logs(test_uid):
testrun_logger=logs.get_record_logger_for(test_uid)
testrun_base_logger=logging.getLogger(logs.RECORD_LOGGER)
# Replace openhtf's root handler with a pass-along to the test record.openhtf_logger=logging.getLogger('openhtf')
ProxyLogger(openhtf_logger, testrun_logger)
I do that for the 'openhtf' logger, as well as my org's base logger. This does assume only 1 test running in the process at a time, but that's okay for us for now.
Hey @fahhem thanks for the info on the UID. I am still a bit unsure when can I get a test UID. When I do htf.Test().uid I get None. Am I missing something?
Configure logging handlers so all loggers show up in openHTF logger and test record
The text was updated successfully, but these errors were encountered: