Skip to content

Commit

Permalink
fix: Use CallerFlagMode type alias instead of uint8 (#155)
Browse files Browse the repository at this point in the history
Signed-off-by: Shyunn <[email protected]>
Co-authored-by: Shyunn <[email protected]>
  • Loading branch information
ShyunnY and Shyunn authored Dec 18, 2024
1 parent 3fd68fc commit 35d7f62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 35d7f62

Please sign in to comment.