(aws-lambda-nodejs): add log levels for yarn, npm, pnpm
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Currently there is an enum `LogLevel` that is defined [here](https://github.com/aws/aws-cdk/blob/9c0de51c6ddacc2858ae949590229dd4919cbb61/packages/aws-cdk-lib/aws-lambda-nodejs/lib/types.ts#L67). However, this enum is used in numerous places:
1. [yarn](https://github.com/aws/aws-cdk/blob/9c0de51c6ddacc2858ae949590229dd4919cbb61/packages/aws-cdk-lib/aws-lambda-nodejs/lib/package-manager.ts#L36)
2. [pnpm](https://github.com/aws/aws-cdk/blob/9c0de51c6ddacc2858ae949590229dd4919cbb61/packages/aws-cdk-lib/aws-lambda-nodejs/lib/package-manager.ts#L42)
3. [npm](https://github.com/aws/aws-cdk/blob/9c0de51c6ddacc2858ae949590229dd4919cbb61/packages/aws-cdk-lib/aws-lambda-nodejs/lib/package-manager.ts#L52)
4. [esbuild](https://github.com/aws/aws-cdk/blob/9c0de51c6ddacc2858ae949590229dd4919cbb61/packages/aws-cdk-lib/aws-lambda-nodejs/lib/bundling.ts#L236)
I believe the enum was original intended for use by `esbuild`, but it's being used in all four places now. If you look at the code for `yarn` and `pnpm`, it doesn't really use the log level at all. Also, the four do not share the same log levels (per their doc), although they are similar. I'd like to extend this package by adding more granularity in log level.
### Use Case
`yarn`, `pnpm`, `npm`, and `esbuild` share a log level. More granularity should be offered.
### Proposed Solution
Add additional enums and maybe a "clamper." Per @indrora in #27634: "I could easily see the enum having all these levels but a helper function that "clamps" it at a maximum level (since one tool doesn't know VERBOSE, it would be clamped somehow)."
### Other Information
Related to #27634.
### Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
v2.102.0
### Environment details (OS name and version, etc.)
Mac OS
Contributor guide
Assessment
This issue has not been assessed yet.