错误日志打印堆栈

This commit is contained in:
kercylan98 2023-05-20 15:16:34 +08:00
parent 4f013f593e
commit 4e31cf90df
1 changed files with 2 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
"io" "io"
"os" "os"
"runtime/debug"
"time" "time"
) )
@ -99,6 +100,7 @@ func Debug(msg string, fields ...zap.Field) {
func Error(msg string, fields ...zap.Field) { func Error(msg string, fields ...zap.Field) {
logger.Error(msg, fields...) logger.Error(msg, fields...)
fmt.Println(string(debug.Stack()))
} }
func SetProd() { func SetProd() {