Improve logging integration with VIP-CLI #170
Open
+140
−101
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.
This pull request refactors and enhances the logging system to provide better log context, flexibility, and maintainability. The main improvements include support for logger child instances with contextual log names, more flexible configuration for log file output, and improved handling of sanitized keys for sensitive information. These changes impact the logger implementation and how loggers are instantiated and used throughout the application.
Logger architecture and context improvements:
logNameusing a newchildmethod in theLogclass, enabling better separation and identification of log messages from different components. (lib/logger.js,lib/app.js) [1] [2]AppandLandoclasses to utilize the new child logger functionality, ensuring each app instance logs with its own context. (lib/app.js,lib/lando.js) [1] [2]Logging configuration and file output:
Logclass constructor to accept alogFileparameter, allowing logs to be written to a specific file, and improved logic for file transport setup (including absolute/relative paths and directory creation). (lib/logger.js) [1] [2]lib/logger.js)Sensitive data handling:
sanitizedKeys(the list of keys to redact in logs), ensuring child loggers and logger instances created with an existing logger maintain consistent sanitization. (lib/logger.js) [1] [2]Log formatting:
logNamein both console and file outputs, improving clarity and traceability of log messages. (lib/logger.js) [1] [2] [3]