packethost/pkg

How to use the log pkg as a grpc middleware

Closed this issue · 4 comments

In cloud connect I'm using the grpc zap middleware for logging: https://github.com/grpc-ecosystem/go-grpc-middleware

But I'm having trouble using the wrapped zap logger with the grpc middleware (since it's not expecting the wrapped logger struct, but *zap.Logger instead).

I'm wondering if there's a way around this/I'm missing something

Is there a reason we're not using an embedded struct?

mmlb commented

Posting from our slack DM:

We should have a method on the Logger that returns a gprc log middleware or even a unary/stream handler (can do former and leave latter for later if ever). This way we don't expose that today we wrap zap and have to deal with it tomorrow.

mmlb commented

We don't do an embedded struct because we want to wrap a log package and expose only what we need/provide.

mmlb commented

closed in #11