Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: logger cannot correctly handle varargs #139

Merged
merged 2 commits into from
Aug 17, 2022
Merged

fix: logger cannot correctly handle varargs #139

merged 2 commits into from
Aug 17, 2022

Conversation

Andello
Copy link
Contributor

@Andello Andello commented May 30, 2022

the defaultLogger.CtxXXXf would pass varargs by slice as first argument, without keeping its original form.

Example:
logger.CtxInfof(ctx "%v %v", 1, 2) would produce [Info] [1, 2] %!v(MISSING). It prints the whole varargs as one slice, so the second vararg is MISSING.

@alingse
Copy link

alingse commented Jul 9, 2022

+1 see https://github.com/alingse/asasalint/runs/7264904062?check_suite_focus=true

Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:100:23: pass []any as any to func Notice func(v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:124:22: pass []any as any to func Trace func(v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:153:32: pass []any as any to func Noticef func(format string, v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:1[7](https://github.com/alingse/asasalint/runs/7264904062?check_suite_focus=true#step:7:8)7:31: pass []any as any to func Tracef func(format string, v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:1[8](https://github.com/alingse/asasalint/runs/7264904062?check_suite_focus=true#step:7:9)2:39: pass []any as any to func CtxFatalf func(ctx context.Context, format string, v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:1[9](https://github.com/alingse/asasalint/runs/7264904062?check_suite_focus=true#step:7:10)0:39: pass []any as any to func CtxErrorf func(ctx context.Context, format string, v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:198:38: pass []any as any to func CtxWarnf func(ctx context.Context, format string, v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:206:40: pass []any as any to func CtxNoticef func(ctx context.Context, format string, v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:214:38: pass []any as any to func CtxInfof func(ctx context.Context, format string, v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:222:39: pass []any as any to func CtxDebugf func(ctx context.Context, format string, v ...interface{})
Error: /home/runner/work/asasalint/asasalint/gopkg/util/logger/logger.go:230:39: pass []any as any to func CtxTracef func(ctx context.Context, format string, v ...interface{})
Error: Process completed with exit code 1.

@PureWhiteWu
Copy link
Collaborator

Sorry for the late reply, I missed this pr.

@PureWhiteWu
Copy link
Collaborator

PTAL @zhangyunhao116

@PureWhiteWu PureWhiteWu merged commit b879a72 into bytedance:develop Aug 17, 2022
joway pushed a commit to joway/gopkg that referenced this pull request Apr 17, 2024
Co-authored-by: Pure White <wudi.daniel@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants