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

feat: copy Caller to new entry if reportCaller is not set #1251

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shallowclouds
Copy link

@shallowclouds shallowclouds commented Mar 25, 2021

Copy Caller to new entry if ReportCaller is not set when log.

There are some scenarios where users want to pass the caller by themself, for example, many libraries accept a logger interface and use it to output internal log(such as SQL exec log for Gorm), many users wrap logrus to the needed interface, but the caller got by logrus is inaccuracy in this case, and need to get the caller and pass it into Entry, just throwing caller away will break wrapped loggers for these libraries.

Passing caller in Entry works util #1229 imported Dup to fix race condition issue.

Copy `Caller` to new entry if ReportCaller is not set when `log`.

Change-Id: I2d854c9b32bf16917ae880a04c2cfea3e41af451
@shallowclouds
Copy link
Author

@dgsb Could I ask you for code review? Do you think this is valuable for users?(This does value for me) Thanks!

@shallowclouds
Copy link
Author

It seems that #1215 has done this, but it may be completed without importing a new method to Entry.

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.

None yet

1 participant