-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Ability to modify log message #149
Comments
Yes, the same way Rails Semantic Logger swapped out the Rails built-in log subscriber, you can swap out the Rails Semantic Logger built-in log subscriber with your own. Rather than changing the message itself, other developers add log tags to every request, using |
I know the And yes, log tags are very helpful, and I do plan to use them, but we aggregate logs from many different sources and we usually just show the message and then you can click the entry to view details. I was hoping there could be some way to make the message more informative. |
I have a similar issue. My use case is Rails running in Docker with a read-only filesystem. This runs in Google Cloud Platform so logs sent to stdout are collected in Cloud Logging automatically, and Cloud Logging likes fluentd formatting so I send logs formatted as When I view the logs in Cloud Logging all I see is "Completed #show" until I click on it to show the jsonPayload. It would be great if I could say "set the message field to the output of I hope this helps illustrate the utility of customizing |
Sounds like a common need, anyone want to submit a pull request with a solution? |
Is there any way you could add the ability to override the message that is logged with given events? (For example, in lieu of
Completed ##{payload[:action]}
)A simple implementation could be to replace the message with one from the payload if set at a certain key.
Unfortunately, it's not easy to do otherwise via monkeypatching or similar because blocks (instead of functions) are used to generate log data (example).
Environment
The text was updated successfully, but these errors were encountered: