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

Minimum Log Levels #28

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

Minimum Log Levels #28

wants to merge 1 commit into from

Conversation

sergiosalvatore
Copy link
Contributor

@sergiosalvatore sergiosalvatore commented Oct 23, 2024

In the case of leveled logging, allow the user to set a minimum log level via the leveled.FilteredLogger type or through the gkelog.WithMinSeverity function which pipes it through the context.

This allows us to suppress logs that are lower than the minimum level.

@sergiosalvatore sergiosalvatore marked this pull request as ready for review October 23, 2024 18:51
@sergiosalvatore sergiosalvatore force-pushed the min-log-levels branch 2 times, most recently from dccd3a7 to 96957cc Compare October 23, 2024 19:46
type defaultLogger struct {
*alog.Logger

// Indicates the minimum level to log at. If MinLevel is greater than the
// leve of a given log message, the log message will be suppressed.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: leve

@@ -39,32 +65,50 @@ func Default(logger *alog.Logger) Logger {
}
}

// Filtered returns an advanced logger that allows for setting the minimum
Copy link
Contributor

Choose a reason for hiding this comment

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

don't need "advanced"

In the case of leveled logging, allow the user to set a minimum log
level via the leveled.FilteredLogger type or through the
gkelog.WithMinSeverity function which pipes it through the context.

This allows us to suppress logs that are lower than the minimum level.
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