elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
309 stars 112 forks source link

remove pid when logger error for easy aggregate error log #117

Closed redink closed 6 years ago

redink commented 6 years ago

pid is not useful here, but it will not easy to aggregate error log with pid.

josevalim commented 6 years ago

If the purpose is aggregation, then I would suggest you to enable the Logger tags and include the application as a tag. This way you can aggregate everything that comes from DBConnection. We can also add more tags but I don't think we should remove useful information from the message (and I do find the PID useful).

Thank you.

redink commented 6 years ago

But how to enable Logger tags ?

I only know how to use metadata, and if I want to use metadata, I have to change the method to call Logger.error. So I am not sure how to do without change this code.

fishcakez commented 6 years ago

Mix/Logger will add the metadata application: :db_connection to the Logger.error calls. Also a callback module can call Logger.metadata in the connect callback to add extra metadata. Note that these calls can also be identified with module: DBConnection.Connection metadata.