Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions io/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,14 @@ func (l *StandardLogger) Debugf(msg string, args ...any) {
}
}

func (l *StandardLogger) Error(err error, msg string) {
func (l *StandardLogger) WrapError(err error, msg string) {
if msg == "" {
l.Errorf(err.Error())
l.Error(err.Error())
return
} else if l.mode == Hidden {
return
}
l.Errorx(err.Error(), "err", err)
l.Error(err.Error(), "err", err)
}

func (l *StandardLogger) Errorf(msg string, args ...any) {
Expand Down Expand Up @@ -288,7 +288,7 @@ func (l *StandardLogger) Fatalf(msg string, args ...any) {
}
}

func (l *StandardLogger) Infox(msg string, kv ...any) {
func (l *StandardLogger) Info(msg string, kv ...any) {
l.syncLoggerFormat()
if l.mode == Hidden {
return
Expand All @@ -299,7 +299,7 @@ func (l *StandardLogger) Infox(msg string, kv ...any) {
}
}

func (l *StandardLogger) Noticex(msg string, kv ...any) {
func (l *StandardLogger) Notice(msg string, kv ...any) {
if l.mode == Hidden {
return
}
Expand All @@ -310,7 +310,7 @@ func (l *StandardLogger) Noticex(msg string, kv ...any) {
}
}

func (l *StandardLogger) Debugx(msg string, kv ...any) {
func (l *StandardLogger) Debug(msg string, kv ...any) {
if l.mode == Hidden {
return
}
Expand All @@ -321,7 +321,7 @@ func (l *StandardLogger) Debugx(msg string, kv ...any) {
}
}

func (l *StandardLogger) Errorx(msg string, kv ...any) {
func (l *StandardLogger) Error(msg string, kv ...any) {
if l.mode == Hidden {
return
}
Expand All @@ -332,7 +332,7 @@ func (l *StandardLogger) Errorx(msg string, kv ...any) {
}
}

func (l *StandardLogger) Warnx(msg string, kv ...any) {
func (l *StandardLogger) Warn(msg string, kv ...any) {
if l.mode == Hidden {
return
}
Expand All @@ -343,7 +343,7 @@ func (l *StandardLogger) Warnx(msg string, kv ...any) {
}
}

func (l *StandardLogger) Fatalx(msg string, kv ...any) {
func (l *StandardLogger) Fatal(msg string, kv ...any) {
l.syncLoggerFormat()
if l.archiveHandler != nil {
l.archiveHandler.Error(msg, kv...)
Expand Down Expand Up @@ -438,6 +438,6 @@ func (l *StandardLogger) syncLoggerFormat() {
}
}

func defaultExit(_ string, args ...any) {
func defaultExit(_ string, _ ...any) {
os.Exit(1)
}
148 changes: 74 additions & 74 deletions io/mocks/mock_logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions io/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ func (w StdOutWriter) Write(p []byte) (n int, err error) {
if strings.TrimSpace(line) == "" {
continue
}
if len(w.LogFields) > 0 {
w.Logger.Infox(line, w.LogFields...)
} else {
w.Logger.Infof(line)
}
w.Logger.Info(line, w.LogFields...)
}
default:
return len(p), fmt.Errorf("unknown log mode %v", curMode)
Expand Down Expand Up @@ -83,11 +79,7 @@ func (w StdErrWriter) Write(p []byte) (n int, err error) {
if strings.TrimSpace(line) == "" {
continue
}
if len(w.LogFields) > 0 {
w.Logger.Noticex(line, w.LogFields...)
} else {
w.Logger.Noticef(line)
}
w.Logger.Notice(line, w.LogFields...)
}
default:
return len(p), fmt.Errorf("unknown log mode %v", w.LogMode)
Expand Down
Loading
Loading