Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,8 @@ export class Provider extends Construct implements ICustomResourceProvider {
handler: `framework.${entrypoint}`,
timeout: FRAMEWORK_HANDLER_TIMEOUT,

logFormat: lambda.LogFormat.JSON,
// Using loggingFormat instead of deprecated logFormat which will be removed in the next major release
loggingFormat: lambda.LoggingFormat.JSON,
applicationLogLevelV2: loggingLevel,
// props.logRetention is deprecated, make sure we only set it if it is actually provided
// otherwise jsii will print warnings even for users that don't use this directly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,37 @@ test('Log level are set to FATAL by default', () => {
});
});

test('uses loggingFormat instead of deprecated logFormat', () => {
// GIVEN
// Spy on console.warn to check for deprecation warnings
// eslint-disable-next-line no-console
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => { });

const stack = new Stack();
const handler = new lambda.Function(stack, 'MyHandler', {
code: new lambda.InlineCode('foo'),
handler: 'index.onEvent',
runtime: lambda.Runtime.NODEJS_LATEST,
});

try {
// WHEN
new cr.Provider(stack, 'MyProvider', {
onEventHandler: handler,
});

// THEN
// Check that no deprecation warnings related to logFormat were emitted
const deprecationWarnings = warnSpy.mock.calls
.filter(args => typeof args[0] === 'string' && args[0].includes('logFormat is deprecated'));

expect(deprecationWarnings.length).toBe(0);
} finally {
// Clean up
warnSpy.mockRestore();
}
});

describe('retry policy', () => {
const stack = new Stack();

Expand Down
Loading