Try to neste json string in message for new relic logs
This commit is contained in:
parent
e08d5574f7
commit
2c4ae02c4d
|
|
@ -1,3 +1,4 @@
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
@ -17,22 +18,13 @@ def structlog_add_app_info(
|
||||||
return event_dict
|
return event_dict
|
||||||
|
|
||||||
|
|
||||||
def structlog_add_to_message(
|
def structlog_add_to_message(_: logging.Logger, __: str, event_dict: EventDict) -> str:
|
||||||
_: logging.Logger, __: str, event_dict: EventDict
|
|
||||||
) -> EventDict:
|
|
||||||
"""
|
"""
|
||||||
The *event_dict* is added as dict ``message``.
|
The *event_dict* is added as dict ``message``.
|
||||||
|
|
||||||
This allows you to defer formatting to `logging`.
|
This allows you to defer formatting to `logging`.
|
||||||
"""
|
"""
|
||||||
return {
|
return json.dumps(event_dict)
|
||||||
"message": event_dict,
|
|
||||||
**{
|
|
||||||
kw: event_dict.pop(kw)
|
|
||||||
for kw in ("exc_info", "stack_info", "stackLevel")
|
|
||||||
if kw in event_dict
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def structlog_inject_context_dict(test, level, event_dict):
|
def structlog_inject_context_dict(test, level, event_dict):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue