From 3e1ad465077960e37f7d199b39beea7b1232118e Mon Sep 17 00:00:00 2001 From: pilagod Date: Mon, 18 Mar 2019 11:55:59 +0800 Subject: [PATCH] add set flags for individual logger --- logger.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/logger.go b/logger.go index f320731..f30e348 100644 --- a/logger.go +++ b/logger.go @@ -167,6 +167,14 @@ func (l *Logger) Close() { } } +// SetFlags sets the output flags for the logger. +func (l *Logger) SetFlags(flag int) { + l.infoLog.SetFlags(flag) + l.warningLog.SetFlags(flag) + l.errorLog.SetFlags(flag) + l.fatalLog.SetFlags(flag) +} + // Info logs with the Info severity. // Arguments are handled in the manner of fmt.Print. func (l *Logger) Info(v ...interface{}) { @@ -351,7 +359,7 @@ func Errorf(format string, v ...interface{}) { defaultLogger.output(sError, 0, fmt.Sprintf(format, v...)) } -// Fatalln uses the default logger, logs with the Fatal severity, +// Fatal uses the default logger, logs with the Fatal severity, // and ends with os.Exit(1). // Arguments are handled in the manner of fmt.Print. func Fatal(v ...interface{}) {