Skip to content
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

extract logging middleware #9

Merged
merged 12 commits into from
May 17, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add req in logger
  • Loading branch information
gimmyxd committed May 2, 2024
commit a76e45964158a0ac06bc6f4b425cd6f998d2248a
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/cover.out
/tenant.db
/.dev
/.ext
/.ext

# https://github.com/golang/go/issues/53502
# go.work.sum is machine specific and should not be checked in
go.work.sum

.DS_Store
2 changes: 1 addition & 1 deletion grpcutil/middlewares/tracing/tracing_middleware.go
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ var _ grpcutil.Middleware = &TracingMiddleware{}

func (m *TracingMiddleware) Unary() grpc.UnaryServerInterceptor {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
logger := m.logger.Hook(tracingHook{}).With().Ctx(ctx).Logger()
logger := m.logger.Hook(tracingHook{}).With().Interface("req", req).Ctx(ctx).Logger()
loggerCtx := logger.WithContext(ctx)

logger.Trace().Interface("request", req).Msg("grpc call start")
Loading