Skip to content

Commit

Permalink
chore(lambda): match enum value to property (aws#30472)
Browse files Browse the repository at this point in the history
Looks like we are comparing `LogFormat` to the `LoggingFormat` enum. This is not technically a problem for us because `LogFormat` is a string. We deprecated it and created `LoggingFormat` to enforce the enum.

This conditional works because all the enums collapse to strings, but it is best if we sync up the properties with their correct enums.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
scanlonp authored and Leonardo Gama committed Jun 11, 2024
1 parent 405ff95 commit 85a30e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-lambda/lib/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ export class Function extends FunctionBase {
}

if (props.applicationLogLevel || props.applicationLogLevelV2 || props.systemLogLevel || props.systemLogLevelV2) {
if (props.logFormat !== LoggingFormat.JSON && props.loggingFormat === undefined) {
if (props.logFormat !== LogFormat.JSON && props.loggingFormat === undefined) {
throw new Error(`To use ApplicationLogLevel and/or SystemLogLevel you must set LogFormat to '${LogFormat.JSON}', got '${props.logFormat}'.`);
}

Expand Down

0 comments on commit 85a30e4

Please sign in to comment.