feat: Add centralized Logger and ErrorManager with multi-level logging and error classification#1944
Merged
aman19K merged 3 commits intodevelopmentfrom Jun 3, 2025
Merged
Conversation
packages/contentstack-utilities/test/unit/cliErrorHandler.test.ts
Dismissed
Show dismissed
Hide dismissed
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a centralized Logger and ErrorManager to standardize multi-level logging and error classification across CLI utilities. Key changes include:
- A new CLIErrorHandler class for robust error normalization, classification, and redaction.
- Enhancements to TypeScript interfaces (LoggerConfig, PrintOptions, etc.) and logging constants.
- Version updates in several package.json files to integrate the new cli-utilities improvements.
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/contentstack-utilities/src/logger/cliErrorHandler.ts | Added new error handler with classification, debug payload extraction, and sensitive info redaction logic. |
| packages/contentstack-utilities/src/interfaces/index.ts | Extended interfaces with LoggerConfig, PrintOptions, and LogType definitions. |
| packages/contentstack-utilities/src/constants/logging.ts | Added logging level definitions and color mappings. |
| packages/contentstack-utilities/src/constants/errorTypes.ts | Introduced standardized error type constants. |
| Package.json files in various packages | Upgraded dependency versions to use the new cli-utilities version. |
netrajpatel
approved these changes
Jun 3, 2025
cs-raj
approved these changes
Jun 3, 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.
This PR introduces a standardized Logger and ErrorManager within the cli-utilities package to enforce consistent logging and error handling across CLI commands.
Changes Implemented
Added logger.ts utility with:
Added errorManager.ts utility with:
Evaluated and integrated with existing cli-error implementation:
Added unit tests for: