-
Notifications
You must be signed in to change notification settings - Fork 301
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
Add Support to ZeroLog #150
Comments
@matheus-meneses - thanks for this input. Can you confirm that you mean that we add support for the go-agent to send its log messages to zerolog? |
I'm curious about is as well as we heavily use zerolog at OneFootball. For the go-agent to log using zerolog I did a very simple wrapper: import "github.com/rs/zerolog"
const prefix = "_newrelic_agent_"
type nrLogger struct {
l zerolog.Logger
}
func (l nrLogger) Error(msg string, context map[string]interface{}) {
l.l.Error().Fields(sanitiseLogKeys(context)).Msg(msg)
}
func (l nrLogger) Warn(msg string, context map[string]interface{}) {
l.l.Warn().Fields(sanitiseLogKeys(context)).Msg(msg)
}
func (l nrLogger) Info(msg string, context map[string]interface{}) {
l.l.Info().Fields(sanitiseLogKeys(context)).Msg(msg)
}
func (l nrLogger) Debug(msg string, context map[string]interface{}) {
l.l.Debug().Fields(sanitiseLogKeys(context)).Msg(msg)
}
func (l nrLogger) DebugEnabled() bool {
return l.l.Debug().Enabled()
}
func sanitiseLogKeys(m map[string]interface{}) map[string]interface{} {
final := make(map[string]interface{}, len(m))
for k, v := range m {
final[prefix+k] = v
}
return final
} It also prefixes all keys from the go-agent to avoid collision with our own log keys. Is that what you're looking for @matheus-meneses ? It would be awesome to have it as part of the go-agent. |
We're taking a look at the input above, as well as the plugin to support it with a view to putting it into the next release of the Go Agent. Let us know if you have any other comments or suggestions! |
I am closing this issue to consolidate tickets about zerolog logs in context. We are still planning this work, but will now track it from the ticket that is already on our roadmap: #178 |
Hi guys,
Is there a roadmap to introduce support to https://github.com/rs/zerolog ?
Regards
The text was updated successfully, but these errors were encountered: