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

Minor logger improovments #1495

Merged
merged 2 commits into from
May 31, 2024
Merged

Minor logger improovments #1495

merged 2 commits into from
May 31, 2024

Conversation

jetexe
Copy link
Contributor

@jetexe jetexe commented May 29, 2024

What was changed

  1. Move WithLogger interface close to others (same package, different file)
  2. Add skip 1 for default WithLogger implementation

Why?

  1. Moving WithLogger interface allow user to see all available interfaces in one place. It increase user experience
  2. Adding Skip function to the withLogger constructor functions allows to skip with_logger.go from the stack

Checklist

  1. How was this tested: All existing tests passed, local using replaced package
  2. Any docs updates needed? nope

@jetexe jetexe requested a review from a team as a code owner May 29, 2024 14:56
@CLAassistant
Copy link

CLAassistant commented May 29, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@@ -57,7 +52,7 @@ type withLogger struct {
}

func newWithLogger(logger Logger, keyvals ...interface{}) *withLogger {
return &withLogger{logger: logger, keyvals: keyvals}
return &withLogger{logger: Skip(logger, 1), keyvals: keyvals}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to confirm, this code path would only matter if the logger did not implement WithLogger but did implement WithSkipCallers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you right.
Skip function will ignore logger in case it doesn't implement WithSkipCallers interface

Copy link
Contributor

Choose a reason for hiding this comment

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

hm I wonder how common this actually is, but in principle this change makes sense I think

@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit 486c233 into temporalio:master May 31, 2024
13 checks passed
@jetexe jetexe deleted the minor-logger-improovments branch June 3, 2024 08:57
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.

3 participants