diff --git a/common.go b/common.go index c7f0c01..3be9c9c 100644 --- a/common.go +++ b/common.go @@ -94,12 +94,15 @@ func (fn ClockFn) Now() time.Time { return fn() } +// CallerFlagMode Defines the Caller backtrace information mode. +type CallerFlagMode = uint8 + // NOTICE: you must set `Logger.ReportCaller=true` for reporting caller. // then config the Logger.CallerFlag by follow flags. const ( // CallerFlagFnlFcn report short func name with filename and with line. // eg: "logger_test.go:48,TestLogger_ReportCaller" - CallerFlagFnlFcn uint8 = iota + CallerFlagFnlFcn CallerFlagMode = iota // CallerFlagFull full func name with filename and with line. // eg: "github.com/gookit/slog_test.TestLogger_ReportCaller(),logger_test.go:48" CallerFlagFull diff --git a/logger.go b/logger.go index 04a10b2..e456dd1 100644 --- a/logger.go +++ b/logger.go @@ -43,7 +43,8 @@ type Logger struct { // ReportCaller on write log record ReportCaller bool CallerSkip int - CallerFlag uint8 + // CallerFlag used to set caller traceback information in different modes + CallerFlag CallerFlagMode // BackupArgs backup log input args to Record.Args BackupArgs bool // TimeClock custom time clock, timezone