Skip to content

Commit

Permalink
feat(logger) support formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
codeinuit committed Mar 6, 2024
1 parent cdd6bf0 commit 06d0321
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package logger
// Logger interface implementation
type Logger interface {
Info(...any)
Infof(string, ...any)
Warn(...any)
Warnf(string, ...any)
Error(...any)
Errorf(string, ...any)
}
12 changes: 12 additions & 0 deletions pkg/logger/logrus/logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@ func (l LogrusLogger) Info(v ...any) {
l.logger.Info(v...)
}

func (l LogrusLogger) Infof(format string, v ...any) {
l.logger.Infof(format, v...)
}

func (l LogrusLogger) Error(v ...any) {
l.logger.Error(v...)
}

func (l LogrusLogger) Errorf(format string, v ...any) {
l.logger.Errorf(format, v...)
}

func (l LogrusLogger) Warn(v ...any) {
l.logger.Warn(v...)
}

func (l LogrusLogger) Warnf(format string, v ...any) {
l.logger.Warnf(format, v...)
}
12 changes: 12 additions & 0 deletions pkg/logger/zap/zap.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,22 @@ func (z ZapSugarLogger) Info(v ...any) {
z.logger.Info(v)
}

func (z ZapSugarLogger) Infof(format string, v ...any) {
z.logger.Infof(format, v...)
}

func (z ZapSugarLogger) Warn(v ...any) {
z.logger.Info(v)
}

func (z ZapSugarLogger) Warnf(format string, v ...any) {
z.logger.Infof(format, v...)
}

func (z ZapSugarLogger) Error(v ...any) {
z.logger.Info(v)
}

func (z ZapSugarLogger) Errorf(format string, v ...any) {
z.logger.Infof(format, v...)
}

0 comments on commit 06d0321

Please sign in to comment.