Nebo15 / logger_json

JSON logger formatter with support for Google Cloud, DataDog and other for Elixir.

Home Page:https://nebo15.github.io/logger_json/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why do we ignore default metadata?

SophisticaSean opened this issue · comments

The basic logger purges rather useful metadata like line file and function.

When I tested this locally, I was able to completely wipe out the blacklisted fields and this library worked just fine.

I'm happy to make a PR with my changes to remove the rather annoying discard if we're up for that.

@SophisticaSean it was coming from a time when we weren't able to properly encode functions (because we did not have a safe encoder), and even before the same list was part of some Elixir.Logger code :).

The basic formatter is very minimalistic, I'm not sure it's a good idea to change it now because we don't want to accidentally send more data to log ingestion than people that already use it are expecting. If you want to have them in your logs it's better to define your own formatter.

commented

@SophisticaSean I just stared using the basic logger and I was also very surprised that it basically ignores all metadata.
I think the docs should clearly mention what metadata is supported and what not. Right now, there's no mention of metadata being removed.

@maxmarcon Logger only ignores system metadata that is not trivial for encoding to binary or that is already used by formatter. Any custom metadata you sent would be encoded and logged by default.

commented

Thanks @AndrewDryga. However, it's the system metadata (especially mfa) I'm interested in :)
Not saying you guys don't have good reasons for it, all I'm saying is that there should be a sentence in the docs mentioning this.

@maxmarcon I pushed an updated readme, please tell me if you have ideas on how to make it more explicit.

commented

Many thanks @AndrewDryga ! Really appreciated. I left a comment on the commit.