diff --git a/.gitignore b/.gitignore index 79687a0..eaaa391 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ polaris/ .vscode/ style_tool/ -goimports-reviser \ No newline at end of file +goimports-reviser +*.log diff --git a/logger.go b/logger.go index 324923f..d53db74 100644 --- a/logger.go +++ b/logger.go @@ -18,6 +18,7 @@ package grpcpolaris import ( + "fmt" "log" "sync/atomic" @@ -70,7 +71,7 @@ func newDefaultLogger() *defaultLogger { levelRef.Store(LogInfo) return &defaultLogger{ - writer: log.New(lumberJackLogger, "", log.Llongfile|log.Ldate|log.Ltime), + writer: log.New(lumberJackLogger, "", log.Lshortfile|log.Ldate|log.Ltime), levelRef: levelRef, } } @@ -101,5 +102,5 @@ func (l *defaultLogger) printf(expectLevel LogLevel, format string, args ...inte if curLevel > expectLevel { return } - l.writer.Printf(format, args...) + _ = l.writer.Output(3, fmt.Sprintf(format, args...)) }