uber-go / zap

Blazing fast, structured, leveled logging in Go.
https://pkg.go.dev/go.uber.org/zap
MIT License
22.03k stars 1.43k forks source link

Introduce Mute/None log level #729

Open kriskowal opened 5 years ago

kriskowal commented 5 years ago

YARPC observability middleware allow users to specify a log level for (inbound, outbound) x (success, failure, application error) traffic edges as of https://github.com/yarpc/yarpc-go/pull/1763. Users would like to be able to mute certain edges, such that they can see their own debug messages without seeing YARPC’s.

Currently, the best advice we can provide is to raise the development log level to "info" to suppress the YARPC debug logs, then raise application log messages to "info" during development, requiring the application debug log level to be configurable. This is acceptable but unpalatable.

To this end, would it be wise to introduce a new Mute or None debug level with numeric value -2? If so, I can initiate a change.

prashantv commented 5 years ago

Some related issues: #680 & #713

I think this is a slightly different request -- it's asking for a level that will never be logged, which allows for easily disabling logging via level. If we do this:

This makes sense at a high level to me, we should get another opinion too.

abhinav commented 5 years ago

A None level (with a large negative value) sounds reasonable to me.

jcorbin commented 5 years ago

A zap.NoneLevel = -1000 (or so) seems reasonable to me; in addition to sampler (as mentioned by prashant) I suppose we should add guards to all care implementations that zap ships, e.g. zapcore.ioCore.Write, zapcore.multiCore.Write, etc).

LeviMatus commented 4 years ago

If this is still something that is still desired then I'd like to take it up.

abhinav commented 3 years ago

Since adding a new level would be a breaking change, we'd like to avoid doing so in 1.0.

We should defer this to a 2.0, whenever that happens. (https://github.com/uber-go/zap/issues/388)