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

Adhere to logr.CallDepthLogSink #4

Merged
merged 2 commits into from
Nov 14, 2022

Conversation

DennisVis
Copy link

Hi there. Thank you for this library, it's allowing me to create custom logr sinks quite easily.

I noticed that the LogSink supports arbitrary call depth through the WithCallerDepth function. This seems to be in line with the logr.CallDepthLogSink except that the naming is different. This PR fixes that naming and makes the LogSink adhere to the logr.CallDepthLogSink interface. This will allow logr.Logger to leverage this functionality: https://github.com/go-logr/logr/blob/master/logr.go#L336

I also noticed a duplicated type check. I replaced one of those with a new check for logr.CallDepthLogSink.

To be able to test the WithCallDepth function I replaced the logr.Logger type in caller_test.go with a small interface.

DennisVis pushed a commit to DennisVis/genericr that referenced this pull request Nov 11, 2022
Replace the repo name so that this project can be used stand alone,
until a pull request in the forked repo is merged.

Ref: wojas#4
Copy link
Owner

@wojas wojas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me! Just one minor fix in a test error string needed.

genericr_test.go Outdated Show resolved Hide resolved
@wojas wojas merged commit 5592d36 into wojas:master Nov 14, 2022
@wojas wojas added this to the v0.3.1 milestone Nov 14, 2022
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.

2 participants