Skip to content

Commit

Permalink
Remove preceding "L" character before log output [0.2.x] (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
liranbg authored Aug 4, 2021
1 parent e14b432 commit f52a0bb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions nuclio_sdk/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
import nuclio_sdk.json_encoder


class JSONFormatter(logging.Formatter):
class RawJSONFormatter(logging.Formatter):
def __init__(self):
super(JSONFormatter, self).__init__()

super(RawJSONFormatter, self).__init__()
self._json_encoder = nuclio_sdk.json_encoder.Encoder()

def format(self, record):
Expand All @@ -31,7 +30,15 @@ def format(self, record):
'with': getattr(record, 'with', {}),
}

return 'l' + self._json_encoder.encode(record_fields)
return self._json_encoder.encode(record_fields)


class JSONFormatter(RawJSONFormatter):

def format(self, record):

# on version >= 0.4.0, the `l` prefix is omitted
return 'l' + super(JSONFormatter, self).format(record)


class HumanReadableFormatter(logging.Formatter):
Expand Down

0 comments on commit f52a0bb

Please sign in to comment.