Skip to content

Commit

Permalink
feat: core support injector
Browse files Browse the repository at this point in the history
  • Loading branch information
dapeng committed Dec 19, 2024
1 parent 8dda00a commit 44a9c89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion goner/gin/http-injector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func Test_httpInjector_Suck(t *testing.T) {

rv := reflect.ValueOf(req).Elem()
for i := 0; i < rv.NumField(); i++ {
err := injector.Suck("query", rv.Type().Field(i))
err := injector.Inject("query", rv.Type().Field(i), rv.Field(i))
assert.Nil(t, err)
}
funcs := injector.CollectBindFuncs()
Expand Down
16 changes: 12 additions & 4 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,27 @@ func (l *defaultLogger) Init() {
}

func (l *defaultLogger) Infof(msg string, args ...any) {
log.Printf(msg, args...)
if l.level <= InfoLevel {
log.Printf(msg, args...)
}
}

func (l *defaultLogger) Errorf(msg string, args ...any) {
log.Printf(msg, args...)
if l.level <= ErrorLevel {
log.Printf(msg, args...)
}
}

func (l *defaultLogger) Warnf(msg string, args ...any) {
log.Printf(msg, args...)
if l.level <= WarnLevel {
log.Printf(msg, args...)
}
}

func (l *defaultLogger) Debugf(msg string, args ...any) {
log.Printf(msg, args...)
if l.level <= DebugLevel {
log.Printf(msg, args...)
}
}

func (l *defaultLogger) GetLevel() LoggerLevel {
Expand Down

0 comments on commit 44a9c89

Please sign in to comment.