Add log level configuration and tests for logger functionality#448
Open
Nicklas2751 wants to merge 1 commit intopaketo-buildpacks:mainfrom
Open
Add log level configuration and tests for logger functionality#448Nicklas2751 wants to merge 1 commit intopaketo-buildpacks:mainfrom
Nicklas2751 wants to merge 1 commit intopaketo-buildpacks:mainfrom
Conversation
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #447
Summary
This pull request introduces a configurable logging system to
libpak, allowing users to control log verbosity using theBP_LOG_LEVELandBP_DEBUGenvironment variables. The changes add a new log level hierarchy, update the logger implementation to respect these levels, and provide comprehensive tests and documentation.Log Level Configuration and Implementation:
LogLeveltype with levels (none,error,info,debug) and logic to parse and select the active level based onBP_LOG_LEVELandBP_DEBUGenvironment variables.BP_DEBUGtakes precedence, and unknown values default toinfo. (log/logger.go)NewPaketoLoggerWithOptionsto enable or disable specific writers based on the configured log level, ensuring only relevant logs are emitted. (log/logger.go)Testing:
log/logger_test.go)Documentation:
README.mdwith a new section explaining log level configuration, use cases, environment variable precedence, and caveats. (README.md)Use Cases
Let user control if and how much logging they want. Disable logging is useful for containers running processes or servers in a buildpack container that communicate via stdio like a MCP server. See #447
Checklist