This repository was archived by the owner on Dec 21, 2024. It is now read-only.
File tree 2 files changed +3
-3
lines changed 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ formatter = CustomJsonFormatter('one;two')
58
58
59
59
# is equivalent to:
60
60
61
- formatter = jsonlogger.JsonFormatter(' (one) (two)' )
61
+ formatter = jsonlogger.JsonFormatter(' % (one)s % (two)s ' )
62
62
```
63
63
64
64
You can also add extra fields to your json output by specifying a dict in place of message, as well as by specifying an ` extra={} ` argument.
@@ -80,7 +80,7 @@ class CustomJsonFormatter(jsonlogger.JsonFormatter):
80
80
else :
81
81
log_record[' level' ] = record.levelname
82
82
83
- formatter = CustomJsonFormatter(' (timestamp) (level) (name) (message)' )
83
+ formatter = CustomJsonFormatter(' % (timestamp)s % (level)s % (name)s % (message)s ' )
84
84
```
85
85
86
86
Items added to the log record will be included in * every* log message, no matter what the format requires.
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ def testFormatKeys(self):
62
62
'threadName'
63
63
]
64
64
65
- log_format = lambda x : ['%({0:s})' .format (i ) for i in x ]
65
+ log_format = lambda x : ['%({0:s})s ' .format (i ) for i in x ]
66
66
custom_format = ' ' .join (log_format (supported_keys ))
67
67
68
68
fr = jsonlogger .JsonFormatter (custom_format )
You can’t perform that action at this time.
0 commit comments