Closed mj0nez closed 5 months ago
This may be interesting but before making overriding the json serializer a first class citizen I would make it possible for users to provide custom classes inherited from ours. So after making to possible to pass another serializer to json_dumps
I'll just move the json_dumps
call in StructlogFormatter.__call__
to an internal helper that may be overridden.
Hi @xrmx, is there a timeline for the next release? This and another small feature are on my wish list for sure!
@thijsmie there's no timeline, but we'll cut a new release eventually in the near future
Hi,
While reading Structlog’s performance guide, I wondered how to integrate orjson with
ecs_logging.StructlogFormatter
. From what I gathered, the standard library’s json module is used in_utils.json_dumps
to provide encoding for both formatters. Would you consider a configurable serializer for this project, to gain some performance? I assume the integration would be pretty straightforward, besides some minor changes injson_dumps
and a new optional argument for the formatters’ initializers. If you agree, I would be happy to contribute. :)