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

cmd/thanos: Extract logger instantiation to pkg/logging #3342

Merged
merged 1 commit into from
Oct 20, 2020

Conversation

brancz
Copy link
Member

@brancz brancz commented Oct 20, 2020

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Extract logger instantiation to the pkg/logging package.

Verification

Moved code, and still compiles :)

@thanos-io/thanos-maintainers

Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

🥇 LGTM

case "debug":
lvl = level.AllowDebug()
default:
panic("unexpected log level")
Copy link
Member

Choose a reason for hiding this comment

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

I realize that we had the same behavior before, but I don't think that panicking is the right action to take when a user mistypes a flag. If this was only possible in a program error, then I would agree, but since it's possible when typing --log.level=eror I think it's too severe.

Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored this a bit, let me know what you think about this approach.

Signed-off-by: Frederic Branczyk <fbranczyk@gmail.com>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

LGTM!

pkg/logging/logger.go Show resolved Hide resolved
@brancz brancz merged commit f494a99 into thanos-io:master Oct 20, 2020
@brancz brancz deleted the extract-logger branch October 20, 2020 11:53
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