Skip to content

Commit

Permalink
Merge pull request #24 from codeinuit/feat/update-logger-to-support-f…
Browse files Browse the repository at this point in the history
…ormating

Feat/update logger to support formating
  • Loading branch information
codeinuit authored Mar 6, 2024
2 parents b253217 + 4823244 commit a52e649
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 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...)
}
16 changes: 14 additions & 2 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)
z.logger.Warn(v)
}

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

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

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

0 comments on commit a52e649

Please sign in to comment.