Skip to content

Commit

Permalink
Merge pull request #519 from dusdjhyeon/dusdjhyeon/logger/fmt-logger
Browse files Browse the repository at this point in the history
feat: add fmt logger
  • Loading branch information
Mohd Uzair authored Jun 27, 2024
2 parents ae755c6 + e69327c commit fc5923f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package logger
import (
"io"
"os"
"fmt"
"time"

"github.com/go-logr/logr"
Expand All @@ -13,8 +14,10 @@ import (

type Handler interface {
Info(description ...interface{})
Infof(format string, args ...interface{})
Debug(description ...interface{})
Warn(err error)
Warnf(format string, args ...interface{})
Error(err error)
SetLevel(level logrus.Level)
GetLevel() logrus.Level
Expand Down Expand Up @@ -117,3 +120,11 @@ func (l *Logger) GetLevel() logrus.Level {
func (l *Logger) UpdateLogOutput(output io.Writer) {
l.handler.Logger.SetOutput(output)
}

func (l *Logger) Infof(format string, args ...interface{}) {
l.handler.Log(logrus.InfoLevel, fmt.Sprintf(format, args...))
}

func (l *Logger) Warnf(format string, args ...interface{}) {
l.handler.Log(logrus.WarnLevel, fmt.Sprintf(format, args...))
}

0 comments on commit fc5923f

Please sign in to comment.