Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions logging/logrus/ctxlogrus/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# ctx_logrus
`import "github.com/grpc-ecosystem/go-grpc-middleware/tags/logrus"`
# ctxlogrus
`import "github.com/grpc-ecosystem/go-grpc-middleware/logrus/ctxlogrus"`

* [Overview](#pkg-overview)
* [Imported Packages](#pkg-imports)
* [Index](#pkg-index)

## <a name="pkg-overview">Overview</a>
`ctx_logrus` is a ctxlogger that is backed by logrus
`ctxlogrus` is a ctxlogger that is backed by logrus

It accepts a user-configured `logrus.Logger` that will be used for logging. The same `logrus.Logger` will
be populated into the `context.Context` passed into gRPC handler code.

You can use `ctx_logrus.Extract` to log into a request-scoped `logrus.Logger` instance in your handler code.
You can use `ctxlogrus.Extract` to log into a request-scoped `logrus.Logger` instance in your handler code.

As `ctx_logrus.Extract` will iterate all tags on from `grpc_ctxtags` it is therefore expensive so it is advised that you
As `ctxlogrus.Extract` will iterate all tags on from `grpc_ctxtags` it is therefore expensive so it is advised that you
extract once at the start of the function from the context and reuse it for the remainder of the function (see examples).

Please see examples and tests for examples of use.
Expand Down Expand Up @@ -42,9 +42,9 @@ AddFields adds logrus fields to the logger.
``` go
func Extract(ctx context.Context) *logrus.Entry
```
Extract takes the call-scoped logrus.Entry from ctx_logrus middleware.
Extract takes the call-scoped logrus.Entry from ctxlogrus middleware.

If the ctx_logrus middleware wasn't used, a no-op `logrus.Entry` is returned. This makes it safe to
If the ctxlogrus middleware wasn't used, a no-op `logrus.Entry` is returned. This makes it safe to
use regardless.

## <a name="ToContext">func</a> [ToContext](./context.go#L59)
Expand Down