Skip to content
This repository was archived by the owner on Dec 31, 2025. It is now read-only.

Commit 93843af

Browse files
Moving warnings to stdError
1 parent e83c600 commit 93843af

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

pkg/logrus/logrus.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ var (
1313
stdError = log.New()
1414
)
1515

16+
// SetLogLevel sets level for both loggers
1617
func SetLogLevel(level log.Level) {
1718
stdOut.Out = os.Stdout
1819
stdError.Out = os.Stderr
20+
// used only for levels >= log.InfoLevel
1921
stdOut.SetLevel(level)
22+
// used only for levels <= log.ErrorLevel
2023
stdError.SetLevel(level)
2124
}
2225

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

6265
// Warn logs a message at level Warn on the standard logger.
6366
func Warn(args ...interface{}) {
64-
stdOut.Warn(args...)
67+
stdError.Warn(args...)
6568
}
6669

6770
// Warning logs a message at level Warn on the standard logger.
6871
func Warning(args ...interface{}) {
69-
stdOut.Warning(args...)
72+
stdError.Warning(args...)
7073
}
7174

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

102105
// Warnf logs a message at level Warn on the standard logger.
103106
func Warnf(format string, args ...interface{}) {
104-
stdOut.Warnf(format, args...)
107+
stdError.Warnf(format, args...)
105108
}
106109

107110
// Warningf logs a message at level Warn on the standard logger.
108111
func Warningf(format string, args ...interface{}) {
109-
stdOut.Warningf(format, args...)
112+
stdError.Warningf(format, args...)
110113
}
111114

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

142145
// Warnln logs a message at level Warn on the standard logger.
143146
func Warnln(args ...interface{}) {
144-
stdOut.Warnln(args...)
147+
stdError.Warnln(args...)
145148
}
146149

147150
// Warningln logs a message at level Warn on the standard logger.
148151
func Warningln(args ...interface{}) {
149-
stdOut.Warningln(args...)
152+
stdError.Warningln(args...)
150153
}
151154

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

0 commit comments

Comments
 (0)