Nebo15 / logger_json

JSON logger formatter with support for Google Cloud, DataDog and other for Elixir.
https://nebo15.github.io/logger_json/
MIT License
237 stars 92 forks source link

Time, Severity, and Message should be merged after metadata in GoogleCloudLogger #111

Closed StandardMikeBenza closed 6 months ago

StandardMikeBenza commented 11 months ago

I recently debugged an issue where my log messages weren't showing up as expected. I had introduced a log message that had time metadata (how long an operation took). Since LoggerJSON.Formatters.GoogleCloudLogger merges the metadata into the map of time, severity, and message, metadata time replaced the actual timestamp. The same would happen for severity or message.

This should at a minimum be documented. Ideally the time, severity, and message would be merged into the metadata. A plus would be some way of warning that the original value had been overwritten and recording the original value.

AndrewDryga commented 6 months ago

Hello @StandardMikeBenza, this was true but behaviour is changed in master branch and now it's not specific to the package. Logger in the latest Elixir versions works on top of Erlang one and it supplies time as a metadata attribute to the formatters. Not sure if you can override it now or now, but closing since there is nothing we can do about it.