fix(net/goai): change default value of RequestBody.Required from true to false, add required tag support for RequestBody (#3796)

This commit is contained in:
John Guo
2024-09-24 11:51:53 +08:00
committed by GitHub
parent e15b543a5b
commit 9af8393758
10 changed files with 107 additions and 20 deletions

View File

@ -355,11 +355,19 @@ func (l *Logger) getFpFromPool(ctx context.Context, path string) *gfpool.File {
// printStd prints content `s` without stack.
func (l *Logger) printStd(ctx context.Context, level int, values ...interface{}) {
// nil logger, print nothing
if l == nil {
return
}
l.print(ctx, level, "", values...)
}
// printErr prints content `s` with stack check.
func (l *Logger) printErr(ctx context.Context, level int, values ...interface{}) {
// nil logger, print nothing
if l == nil {
return
}
var stack string
if l.config.StStatus == 1 {
stack = l.GetStack()

View File

@ -142,5 +142,9 @@ func (l *Logger) Criticalf(ctx context.Context, format string, v ...interface{})
// checkLevel checks whether the given `level` could be output.
func (l *Logger) checkLevel(level int) bool {
// nil logger, print nothing
if l == nil {
return false
}
return l.config.Level&level > 0
}