Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
rsafonseca committed Jul 13, 2023
1 parent aaad692 commit b6f7090
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 29 deletions.
1 change: 1 addition & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const (

// Pitaya App interface
type Pitaya interface {
AddAcceptor(acceptor.Acceptor)
GetDieChan() chan bool
SetDebug(debug bool)
SetHeartbeatTime(interval time.Duration)
Expand Down
56 changes: 28 additions & 28 deletions logger/logrus/logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,109 +9,109 @@ type logrusImpl struct {
Impl logrus.FieldLogger
}

// New returns a new interfaces.Logger implementation based on logrus
// New returns a new interfaces.Logger Implementation based on logrus
func New() interfaces.Logger {
log := logrus.New()
return NewWithLogger(log)
}

// NewWithEntry returns a new interfaces.Logger implementation based on a provided logrus entry instance
// NewWithEntry returns a new interfaces.Logger Implementation based on a provided logrus entry instance
// Deprecated: NewWithEntry is deprecated.
func NewWithEntry(logger *logrus.Entry) interfaces.Logger {
return &logrusImpl{impl: logger}
return &logrusImpl{Impl: logger}
}

// NewWithLogger returns a new interfaces.Logger implementation based on a provided logrus instance
// NewWithLogger returns a new interfaces.Logger Implementation based on a provided logrus instance
// Deprecated: NewWithLogger is deprecated.
func NewWithLogger(logger *logrus.Logger) interfaces.Logger {
return &logrusImpl{impl: logrus.NewEntry(logger)}
return &logrusImpl{Impl: logrus.NewEntry(logger)}
}

// NewWithFieldLogger returns a new interfaces.Logger implementation based on a provided logrus instance
// NewWithFieldLogger returns a new interfaces.Logger Implementation based on a provided logrus instance
func NewWithFieldLogger(logger logrus.FieldLogger) interfaces.Logger {
return &logrusImpl{impl: logger}
return &logrusImpl{Impl: logger}
}

func (l *logrusImpl) Fatal(format ...interface{}) {
l.impl.Fatal(format...)
l.Impl.Fatal(format...)
}

func (l *logrusImpl) Fatalf(format string, args ...interface{}) {
l.impl.Fatalf(format, args...)
l.Impl.Fatalf(format, args...)
}

func (l *logrusImpl) Fatalln(args ...interface{}) {
l.impl.Fatalln(args...)
l.Impl.Fatalln(args...)
}

func (l *logrusImpl) Debug(args ...interface{}) {
l.impl.Debug(args...)
l.Impl.Debug(args...)
}

func (l *logrusImpl) Debugf(format string, args ...interface{}) {
l.impl.Debugf(format, args...)
l.Impl.Debugf(format, args...)
}

func (l *logrusImpl) Debugln(args ...interface{}) {
l.impl.Debugln(args...)
l.Impl.Debugln(args...)
}

func (l *logrusImpl) Error(args ...interface{}) {
l.impl.Error(args...)
l.Impl.Error(args...)
}

func (l *logrusImpl) Errorf(format string, args ...interface{}) {
l.impl.Errorf(format, args...)
l.Impl.Errorf(format, args...)
}

func (l *logrusImpl) Errorln(args ...interface{}) {
l.impl.Errorln(args...)
l.Impl.Errorln(args...)
}

func (l *logrusImpl) Info(args ...interface{}) {
l.impl.Info(args...)
l.Impl.Info(args...)
}

func (l *logrusImpl) Infof(format string, args ...interface{}) {
l.impl.Infof(format, args...)
l.Impl.Infof(format, args...)
}

func (l *logrusImpl) Infoln(args ...interface{}) {
l.impl.Infoln(args...)
l.Impl.Infoln(args...)
}

func (l *logrusImpl) Warn(args ...interface{}) {
l.impl.Warn(args...)
l.Impl.Warn(args...)
}

func (l *logrusImpl) Warnf(format string, args ...interface{}) {
l.impl.Warnf(format, args...)
l.Impl.Warnf(format, args...)
}

func (l *logrusImpl) Warnln(args ...interface{}) {
l.impl.Warnln(args...)
l.Impl.Warnln(args...)
}

func (l *logrusImpl) Panic(args ...interface{}) {
l.impl.Panic(args...)
l.Impl.Panic(args...)
}

func (l *logrusImpl) Panicf(format string, args ...interface{}) {
l.impl.Panicf(format, args...)
l.Impl.Panicf(format, args...)
}

func (l *logrusImpl) Panicln(args ...interface{}) {
l.impl.Panicln(args...)
l.Impl.Panicln(args...)
}

func (l *logrusImpl) WithFields(fields map[string]interface{}) interfaces.Logger {
return &logrusImpl{impl: l.impl.WithFields(fields)}
return &logrusImpl{Impl: l.Impl.WithFields(fields)}
}

func (l *logrusImpl) WithField(key string, value interface{}) interfaces.Logger {
return &logrusImpl{impl: l.impl.WithField(key, value)}
return &logrusImpl{Impl: l.Impl.WithField(key, value)}
}

func (l *logrusImpl) WithError(err error) interfaces.Logger {
return &logrusImpl{impl: l.impl.WithError(err)}
return &logrusImpl{Impl: l.Impl.WithError(err)}
}
14 changes: 14 additions & 0 deletions mocks/app.go

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

3 changes: 2 additions & 1 deletion static.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/golang/protobuf/proto"
"github.com/spf13/viper"
"github.com/topfreegames/pitaya/v2/acceptor"
"github.com/topfreegames/pitaya/v2/cluster"
"github.com/topfreegames/pitaya/v2/component"
"github.com/topfreegames/pitaya/v2/config"
Expand Down Expand Up @@ -222,5 +223,5 @@ func GetModule(name string) (interfaces.Module, error) {
}

func AddAcceptor(ac acceptor.Acceptor) {
return DefaultApp.AddAcceptor(ac)
DefaultApp.AddAcceptor(ac)
}

0 comments on commit b6f7090

Please sign in to comment.