diff --git a/packages/logger/jest.config.cjs b/packages/logger/jest.config.cjs index deb2a416a5..f711f79a2c 100644 --- a/packages/logger/jest.config.cjs +++ b/packages/logger/jest.config.cjs @@ -8,7 +8,12 @@ module.exports = { '^(\\.{1,2}/.*)\\.js$': '$1', }, transform: { - '^.+\\.ts?$': 'ts-jest', + '^.+\\.[tj]sx?$': [ + 'ts-jest', + { + useESM: true, + }, + ], }, moduleFileExtensions: ['js', 'ts'], collectCoverageFrom: ['**/src/**/*.ts', '!**/node_modules/**'], diff --git a/packages/logger/package.json b/packages/logger/package.json index 136f6760ed..7da74efebb 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -100,4 +100,4 @@ "serverless", "nodejs" ] -} \ No newline at end of file +} diff --git a/packages/logger/src/formatter/LogFormatterInterface.ts b/packages/logger/src/formatter/LogFormatterInterface.ts index 0fe1dd9909..49d35154c3 100644 --- a/packages/logger/src/formatter/LogFormatterInterface.ts +++ b/packages/logger/src/formatter/LogFormatterInterface.ts @@ -1,5 +1,6 @@ -import { LogAttributes, UnformattedAttributes } from '../types'; -import { LogItem } from '../log'; +import { LogAttributes } from '../types/Log.js'; +import { UnformattedAttributes } from '../types/Logger.js'; +import { LogItem } from '../log/LogItem.js'; /** * @interface diff --git a/packages/logger/src/formatter/index.ts b/packages/logger/src/formatter/index.ts deleted file mode 100644 index ef5d7b16d8..0000000000 --- a/packages/logger/src/formatter/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './LogFormatter'; -export * from './LogFormatterInterface'; -export * from './PowertoolsLogFormatter'; diff --git a/packages/logger/src/log/LogItemInterface.ts b/packages/logger/src/log/LogItemInterface.ts new file mode 100644 index 0000000000..ed0c89bb0b --- /dev/null +++ b/packages/logger/src/log/LogItemInterface.ts @@ -0,0 +1,9 @@ +import { LogAttributes } from '../types/Log.js'; + +interface LogItemInterface { + addAttributes(attributes: LogAttributes): void; + + getAttributes(): LogAttributes; +} + +export { LogItemInterface }; diff --git a/packages/logger/src/types/formats/PowertoolsLog.ts b/packages/logger/src/types/formats/PowertoolsLog.ts index fa360fef59..9406a2a5fe 100644 --- a/packages/logger/src/types/formats/PowertoolsLog.ts +++ b/packages/logger/src/types/formats/PowertoolsLog.ts @@ -1,4 +1,4 @@ -import type { LogAttributes, LogLevel } from '..'; +import type { LogAttributes, LogLevel } from '../Log.js'; type PowertoolsLog = LogAttributes & { /** diff --git a/packages/logger/src/types/formats/index.ts b/packages/logger/src/types/formats/index.ts index 5a828a385f..03dabd2013 100644 --- a/packages/logger/src/types/formats/index.ts +++ b/packages/logger/src/types/formats/index.ts @@ -1 +1 @@ -export * from './PowertoolsLog'; +export type { PowertoolsLog } from './PowertoolsLog.js';