Mayfly.LogFormatter (Mayfly v1.0.0-rc.1)

Copy Markdown View Source

Logger formatter that emits one JSON object per line in the shape Lambda's advanced logging controls expect, so CloudWatch parses level, request id and tenant id:

{"timestamp":"2026-09-27T07:00:00.123Z","level":"INFO","requestId":"…","tenantId":"…","message":"…"}

Mayfly.Boot installs it when AWS_LAMBDA_LOG_FORMAT=JSON. To use it yourself:

config :logger, :default_formatter, {Mayfly.LogFormatter, []}

All Logger metadata except internal keys is included; values that are not JSON-encodable are inspected.