mirror of
https://github.com/rancher/dynamiclistener.git
synced 2025-06-24 05:47:03 +00:00
Just change the level and output-handler on the logrus's underlying logger.
This commit is contained in:
parent
6b9fa231ef
commit
678e190743
@ -44,16 +44,9 @@ type ListenOpts struct {
|
||||
}
|
||||
|
||||
func ListenAndServe(ctx context.Context, httpsPort, httpPort int, handler http.Handler, opts *ListenOpts) error {
|
||||
writer := logrus.StandardLogger().WriterLevel(logrus.DebugLevel)
|
||||
logger := logrus.StandardLogger()
|
||||
writer := logger.WriterLevel(logrus.DebugLevel)
|
||||
if opts.DisplayServerLogs {
|
||||
// Create a new logger the writes to which are at the same level as it's
|
||||
// configured at, with an "ERROR" prefix (as the server writes "un-levelled"
|
||||
// text to the log stream it's handled).
|
||||
// We aren't grabbing `logrus.StandardLogger()` because that gives a reference
|
||||
// to the one global logger, and we don't want to change its logging level here.
|
||||
logger := logrus.New()
|
||||
logger.SetOutput(logrus.StandardLogger().Out)
|
||||
logger.SetLevel(logrus.ErrorLevel)
|
||||
writer = logger.WriterLevel(logrus.ErrorLevel)
|
||||
}
|
||||
// Otherwise preserve legacy behaviour of displaying server logs only in debug mode.
|
||||
|
Loading…
Reference in New Issue
Block a user