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

Increase Caller Skip Depth by One Layer #55

Closed
ulysseskk opened this issue Jun 25, 2024 · 1 comment
Closed

Increase Caller Skip Depth by One Layer #55

ulysseskk opened this issue Jun 25, 2024 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ulysseskk
Copy link

image
Using the current caller depth skip function only outputs the tool method layer, making it impossible to pinpoint the actual problematic code. The reason is that the logging library by default skips the first 3 layers of calls, but in reality, reaching the actual call requires skipping 4 layers. To solve this problem, it is necessary to specify an additional caller skip layer when initializing the logger.
Current code(utils.go:44):
logger = level.NewFilter(logger, lvl) logger = log.With(logger, "timestamp", log.DefaultTimestampUTC, "caller", log.DefaultCaller)
Correct code:
logger = level.NewFilter(logger, lvl) logger = log.With(logger, "timestamp", log.DefaultTimestampUTC, "caller", log.Caller(4))

@Vonng Vonng self-assigned this Jun 29, 2024
@Vonng Vonng added the bug Something isn't working label Jun 29, 2024
@Vonng Vonng added this to the v0.7 milestone Jun 29, 2024
@Vonng
Copy link
Owner

Vonng commented Jun 29, 2024

Great point! Thank you very much~
Resolved by e41aaff

@Vonng Vonng closed this as completed Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants