-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli): use CliIoHost as logger everywhere (#32708)
### Related to #32346 ### Reason for this change Capture all logs across the CLI as IoMessages so that when we allow customers to use the CDK Core functionality programmatically, these logs are delivered to the customers as messages and now just swallowed across the CLI. ### Description of changes Prevented access to `log()` and `formatLogMessage()`. Now the only ways to log something properly are either through the exported log functions (which is how everyone was doing it anyway), or through `CliIoHost.notify()` directly. CliIoHost is now exposed as a global singleton which is currently only directly exclusively used in `logging.ts` but is effectively used everywhere as all logging functions inevitably call `CliIoHost.notify()` All logging functions now optionally support the following input types ```ts error(`operation failed: ${e}`) // infers default error code `TOOLKIT_0000` error('operation failed: %s', e) // infers default error code `TOOLKIT_0000` error({ message: 'operation failed', code: 'SDK_0001' }) // specifies error code `SDK_0001` error({ message: 'operation failed: %s', code: 'SDK_0001' }, e) // specifies error code `SDK_0001` ``` and everything is now translated into an `IoMessage` and calls `CliIoHost.notify()` from these logging functions. Nothing currently specifies any message code so it's all the generic _0000, _1000, _2000 ### Description of how you validated changes added and updated unit tests ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --------- Co-authored-by: Kaizen Conroy <[email protected]> Co-authored-by: Momo Kornher <[email protected]>
- Loading branch information
1 parent
fb2b229
commit ef135ef
Showing
36 changed files
with
983 additions
and
795 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.