Logrus: Feature request: logrus.SetLevel(MuteLevel)

Created on 17 Aug 2017  路  7Comments  路  Source: sirupsen/logrus

Is there a simple way to silence output. If not I would suggest a new loglevel: MuteLevel/QuietLevel/SilentLevel.

This log level will skip any output. What do you think?

Most helpful comment

There is a discussion on stackexchange on why quiet/silence flags can be useful. I would like to easily implement a mute switch with logrus.

All 7 comments

Why do any logging if it's to be entirely silenced?
Also, you can achieve that by never logging anything as Info, and setting it as the level.

This is also not a standard used anywhere else in Go. For that reason, I'm :-1:

Why do any logging if it's to be entirely silenced?

My use case would be a command line switch to silence output. This is quite common.

You can send all output to /dev/null then.

I believe a global switch to silence logs inside logrus can be useful without using shellfoo or crippling the logging functionality when you need it. If adding this log level breaks common behavior maybe we can add another switch without touching log levels.

There is a discussion on stackexchange on why quiet/silence flags can be useful. I would like to easily implement a mute switch with logrus.

duplicate of #441

Was this page helpful?
0 / 5 - 0 ratings