DataDog Formatter
CLASS | DESCRIPTION |
---|---|
DatadogLogFormatter |
|
DatadogLogFormatter ¶
DatadogLogFormatter(
json_serializer: (
Callable[[LogRecord], str] | None
) = None,
json_deserializer: (
Callable[[dict | str | bool | int | float], str]
| None
) = None,
json_default: Callable[[Any], Any] | None = None,
datefmt: str | None = None,
use_datetime_directive: bool = False,
log_record_order: list[str] | None = None,
utc: bool = False,
use_rfc3339: bool = True,
**kwargs
)
Bases: LambdaPowertoolsFormatter
Changes compared to the default Logger Formatter:
- timestamp format to use RFC3339 e.g., "2023-05-01T15:34:26.841+0200"
PARAMETER | DESCRIPTION |
---|---|
log_record_order
|
description, by default None |
PARAMETER | DESCRIPTION |
---|---|
json_serializer
|
function to serialize
TYPE:
|
json_deserializer
|
function to deserialize
TYPE:
|
json_default
|
function to coerce unserializable values, by default str Only used when no custom JSON encoder is set
TYPE:
|
datefmt
|
String directives (strftime) to format log timestamp. See https://docs.python.org/3/library/time.html#time.strftime or
TYPE:
|
use_datetime_directive
|
Interpret See https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior . This also supports a custom %F directive for milliseconds.
TYPE:
|
log_record_order
|
set order of log keys when logging, by default ["level", "location", "message", "timestamp"]
TYPE:
|
utc
|
set logging timestamp to UTC, by default False to continue to use local time as per stdlib
TYPE:
|
use_rfc3339
|
Whether to use a popular dateformat that complies with both RFC3339 and ISO8601. e.g., 2022-10-27T16:27:43.738+02:00.
TYPE:
|
kwargs
|
Key-value to persist in all log messages
DEFAULT:
|
Source code in aws_lambda_powertools/logging/formatters/datadog.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|