Skip to content

Commit

Permalink
Fix log level value in singer runner process.
Browse files Browse the repository at this point in the history
  • Loading branch information
varunsharma committed Mar 23, 2022
1 parent 19b7ec7 commit 6a85b9a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions singer_runner/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

SINGER_METRICS_PREFIX = 'INFO METRIC: '
SINGER_METRICS_PREFIX_LN = len(SINGER_METRICS_PREFIX)
LOGGING_LEVELS = {
'ERROR' : logging.ERROR,
'WARNING' : logging.WARN,
'INFO' : logging.INFO,
'DEBUG' : logging.DEBUG
}

def log_helper(stream, logger, metrics_storage):
for line in iter(stream.readline, b''):
Expand All @@ -19,8 +25,12 @@ def log_helper(stream, logger, metrics_storage):
if metrics_storage and \
log_line[:SINGER_METRICS_PREFIX_LN] == SINGER_METRICS_PREFIX:
metrics_storage.put(log_line[SINGER_METRICS_PREFIX_LN:])

logger.info(log_line)
log_split = log_line.split(' ', 1)
if len(log_split) > 1:
log_level, log_msg = log_split
logger.log(LOGGING_LEVELS[log_level], log_msg)
else:
logger.info(log_line)

def singer_input_helper(stdin, pipe):
while True:
Expand Down

0 comments on commit 6a85b9a

Please sign in to comment.