Small, easy to use, yet powerful utility packages for logrus.
Add a log entry to the context using logctx.New(ctx, logEntry)
or simply add a new log field using logctx.AddField(ctx, key, value)
. Retrieve the log entry using logctx.From(ctx)
.
Wrap an error with fields using errfield.Add(err, "key", value)
. Use errfield.Formatter
to log the fields in a structured way.
Check the sample HTTP server application and its Step by step guide, to see logrusutil in action.