Closed hammady closed 8 months ago
Please take a look at the new nrslog package!
@iamemilio thanks for the follow-up. I can see nrslog has been added just 3 weeks ago, great job! I had to switch to Logrus to get the complete functionality of structured logging + NR context.
Summary
Go native log package does not support log levels. However, starting from go 1.21, a new standard package was introduced: log/slog which supports structured logging as well as log levels. I was able to integrate the go agent with slog to report logs in context. However, because log levels happen outside the Newrelic
logWriter
, records are all reported without theSeverity
attribute and hence show asUNKNOWN
in the APM UI.Desired Behaviour
I would like the go agent to be able to be integrated deeper with slog so that the correct severity (level) is reported with each record.
Example from the ruby agent:
Additional context
Showing log severity within APM UI is useful in observability like all other agents, nothing specific here. It is only missing because it was not supported in the standard
log
package before, but now it is supported throughlog/slog
Note: Here is how I did the integration with slog: