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

Feature scorecard.Run() should take a leveled logging object/interface instead of or alternatively to log level. #4257

Open
jeffmendoza opened this issue Jul 25, 2024 · 2 comments
Labels
kind/enhancement New feature or request

Comments

@jeffmendoza
Copy link
Member

Is your feature request related to a problem? Please describe.
Describe the solution you'd like

In order to use structured logging and add additional key/values, scorecard.Run() should take a logger interface (of it's own design) and use that for logging.

I recommend something like this: https://pkg.go.dev/github.com/hashicorp/go-retryablehttp#LeveledLogger
That can be implemented by any number of popular loggers, then the calling program can decide what to log or configure the level of the underlying logger.

Describe alternatives you've considered
The logging level is good, but still logs in unstructured format

@jeffmendoza jeffmendoza added the kind/enhancement New feature or request label Jul 25, 2024
@spencerschrock
Copy link
Member

I recommend something like this: https://pkg.go.dev/github.com/hashicorp/go-retryablehttp#LeveledLogger

The standard library also has a structured logging library now too :)

@jeffmendoza
Copy link
Member Author

Looks like the linked interface would work directly with a https://pkg.go.dev/log/slog@go1.22.5#Logger or a https://pkg.go.dev/go.uber.org/zap#SugaredLogger among others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants