Skip to content

Commit

Permalink
Moving warnings to stdError
Browse files Browse the repository at this point in the history
  • Loading branch information
puneetguptanitj committed Oct 19, 2018
1 parent e83c600 commit 93843af
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pkg/logrus/logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ var (
stdError = log.New()
)

// SetLogLevel sets level for both loggers
func SetLogLevel(level log.Level) {
stdOut.Out = os.Stdout
stdError.Out = os.Stderr
// used only for levels >= log.InfoLevel
stdOut.SetLevel(level)
// used only for levels <= log.ErrorLevel
stdError.SetLevel(level)
}

Expand Down Expand Up @@ -61,12 +64,12 @@ func Info(args ...interface{}) {

// Warn logs a message at level Warn on the standard logger.
func Warn(args ...interface{}) {
stdOut.Warn(args...)
stdError.Warn(args...)
}

// Warning logs a message at level Warn on the standard logger.
func Warning(args ...interface{}) {
stdOut.Warning(args...)
stdError.Warning(args...)
}

// Error logs a message at level Error on the standard logger.
Expand Down Expand Up @@ -101,12 +104,12 @@ func Infof(format string, args ...interface{}) {

// Warnf logs a message at level Warn on the standard logger.
func Warnf(format string, args ...interface{}) {
stdOut.Warnf(format, args...)
stdError.Warnf(format, args...)
}

// Warningf logs a message at level Warn on the standard logger.
func Warningf(format string, args ...interface{}) {
stdOut.Warningf(format, args...)
stdError.Warningf(format, args...)
}

// Errorf logs a message at level Error on the standard logger.
Expand Down Expand Up @@ -141,12 +144,12 @@ func Infoln(args ...interface{}) {

// Warnln logs a message at level Warn on the standard logger.
func Warnln(args ...interface{}) {
stdOut.Warnln(args...)
stdError.Warnln(args...)
}

// Warningln logs a message at level Warn on the standard logger.
func Warningln(args ...interface{}) {
stdOut.Warningln(args...)
stdError.Warningln(args...)
}

// Errorln logs a message at level Error on the standard logger.
Expand Down

0 comments on commit 93843af

Please sign in to comment.