Fix initialization of loggers that check process.env.DEBUG; quiet templating logs#1517
Merged
rocketstack-matt merged 7 commits intofinos:mainfrom Aug 12, 2025
Merged
Fix initialization of loggers that check process.env.DEBUG; quiet templating logs#1517rocketstack-matt merged 7 commits intofinos:mainfrom
process.env.DEBUG; quiet templating logs#1517rocketstack-matt merged 7 commits intofinos:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes delayed logger initialization to ensure the --verbose CLI option works correctly, and reduces log noise by changing templating logs from info to debug level. The core issue was that loggers were initialized too early (before CLI parsing) when checking process.env.DEBUG.
Key changes:
- Converted static logger initialization to lazy getters across multiple classes
- Changed templating log levels from
infotodebugto reduce output noise - Updated corresponding test expectations to match the new debug logging behavior
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| shared/src/template/template-processor.ts | Converted static logger to lazy getter pattern |
| shared/src/template/template-path-extractor.ts | Applied lazy logger initialization and changed info logs to debug |
| shared/src/template/template-engine.ts | Applied lazy logger initialization and changed template preprocessing log to debug |
| shared/src/template/template-engine.spec.ts | Updated test to expect debug logging instead of info |
| shared/src/template/template-bundle-file-loader.ts | Applied lazy logger initialization pattern |
| shared/src/resolver/calm-reference-resolver.ts | Applied lazy logger initialization to all resolver classes |
| shared/src/model-visitor/logging-visitor.ts | Applied lazy logger initialization with additional setter for testing |
rocketstack-matt
approved these changes
Aug 12, 2025
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.
Delayed(lazy) logger initialization
Loggers that were defined as:
private static logger = initLogger(process.env.DEBUG === true, ...)were initialized too early, before the CLI parsed the command line options. This meant that the
--verboseoption did not work.This has been changed to a lazy initialisation:
Quiet templating logs
Now that debug level logs are output in the templating parts of
calm docifyandcalm template, we can reduce some of the logs frominfolevel todebuglevel, so thatcalm docifyonly outputs the summary level logs by default.--verboseor before this PR:~/architecture-as-code/calm/getting-started$ npx calm docify --architecture ./conference-signup.arch.json --output ./website --verbose 2>&1 | wc -l--verboseand this PR:~/architecture-as-code/calm/getting-started$ npx calm docify --architecture ./conference-signup.arch.json --output ./website 2>&1 | wc -l