Skip to content

Commit bd771ff

Browse files
author
IliaFeldgun
committed
Fix non-existing console error
1 parent b67ca49 commit bd771ff

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

py/strato/common/log/configurelogging.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,12 @@ def _useColorsForScreenOutput():
109109

110110

111111
def _configureOutputToScreen(logger, loggerName):
112-
if logger.handlers == []:
112+
streamHandlers = [handler for handler in logger.handlers if isinstance(handler, logging.StreamHandler)]
113+
if streamHandlers:
114+
streamHandler = streamHandlers[0]
115+
else:
113116
streamHandler = logging.StreamHandler()
117+
if streamHandler:
114118
if _useColorsForScreenOutput():
115119
streamHandler.setFormatter(coloringformatter.ColoringFormatter(
116120
'%(created).03f(%(process)d%(threadName)s):%(startColor)s%(levelname)s'

0 commit comments

Comments
 (0)