diff --git a/packages/logger/package.json b/packages/logger/package.json index e110072cab..ca0b96ee53 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -20,8 +20,8 @@ "build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", "build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", - "lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .", - "lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .", + "lint": "biome lint .", + "lint:fix": "biome check --write .", "prepack": "node ../../.github/scripts/release_patch_package_json.js ." }, "homepage": "https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/packages/logger#readme", @@ -53,10 +53,7 @@ "lib/cjs/middleware/middy.d.ts", "lib/esm/middleware/middy.d.ts" ], - "types": [ - "lib/cjs/types/index.d.ts", - "lib/esm/types/index.d.ts" - ] + "types": ["lib/cjs/types/index.d.ts", "lib/esm/types/index.d.ts"] } }, "types": "./lib/cjs/index.d.ts", @@ -73,9 +70,7 @@ "optional": true } }, - "files": [ - "lib" - ], + "files": ["lib"], "repository": { "type": "git", "url": "git+https://github.com/aws-powertools/powertools-lambda-typescript.git" diff --git a/packages/logger/src/Logger.ts b/packages/logger/src/Logger.ts index d97e6c2177..d41759915e 100644 --- a/packages/logger/src/Logger.ts +++ b/packages/logger/src/Logger.ts @@ -1,30 +1,30 @@ +import { Console } from 'node:console'; +import { randomInt } from 'node:crypto'; import { Utility } from '@aws-lambda-powertools/commons'; import type { HandlerMethodDecorator } from '@aws-lambda-powertools/commons/types'; import type { Context, Handler } from 'aws-lambda'; import merge from 'lodash.merge'; -import { Console } from 'node:console'; -import { randomInt } from 'node:crypto'; import { EnvironmentVariablesService } from './config/EnvironmentVariablesService.js'; import { LogJsonIndent } from './constants.js'; -import { LogItem } from './formatter/LogItem.js'; +import type { LogItem } from './formatter/LogItem.js'; import { PowertoolsLogFormatter } from './formatter/PowertoolsLogFormatter.js'; import type { ConfigServiceInterface } from './types/ConfigServiceInterface.js'; import type { Environment, LogAttributes, + LogFormatterInterface, LogLevel, LogLevelThresholds, - LogFormatterInterface, } from './types/Log.js'; import type { - LogFunction, ConstructorOptions, + CustomJsonReplacerFn, InjectLambdaContextOptions, + LogFunction, LogItemExtraInput, LogItemMessage, LoggerInterface, PowertoolsLogData, - CustomJsonReplacerFn, } from './types/Logger.js'; /** @@ -442,10 +442,7 @@ class Logger extends Utility implements LoggerInterface { options?: InjectLambdaContextOptions ): HandlerMethodDecorator { return (_target, _propertyKey, descriptor) => { - /** - * The descriptor.value is the method this decorator decorates, it cannot be undefined. - */ - /* eslint-disable @typescript-eslint/no-non-null-assertion */ + // biome-ignore lint/style/noNonNullAssertion: The descriptor.value is the method this decorator decorates, it cannot be undefined. const originalMethod = descriptor.value!; // eslint-disable-next-line @typescript-eslint/no-this-alias @@ -463,8 +460,6 @@ class Logger extends Utility implements LoggerInterface { let result: unknown; try { result = await originalMethod.apply(this, [event, context, callback]); - } catch (error) { - throw error; } finally { if (options?.clearState || options?.resetKeys) loggerRef.resetKeys(); } @@ -697,22 +692,24 @@ class Logger extends Utility implements LoggerInterface { const references = new WeakSet(); return (key, value) => { - if (this.#jsonReplacerFn) value = this.#jsonReplacerFn?.(key, value); + let replacedValue = value; + if (this.#jsonReplacerFn) + replacedValue = this.#jsonReplacerFn?.(key, replacedValue); - if (value instanceof Error) { - value = this.getLogFormatter().formatError(value); + if (replacedValue instanceof Error) { + replacedValue = this.getLogFormatter().formatError(replacedValue); } - if (typeof value === 'bigint') { - return value.toString(); + if (typeof replacedValue === 'bigint') { + return replacedValue.toString(); } - if (typeof value === 'object' && value !== null) { - if (references.has(value)) { + if (typeof replacedValue === 'object' && replacedValue !== null) { + if (references.has(replacedValue)) { return; } - references.add(value); + references.add(replacedValue); } - return value; + return replacedValue; }; } @@ -855,10 +852,10 @@ class Logger extends Utility implements LoggerInterface { * @returns - The name of the log level */ private getLogLevelNameFromNumber(logLevel: number): Uppercase { - let found; + let found: Uppercase | undefined; for (const [key, value] of Object.entries(this.logLevelThresholds)) { if (value === logLevel) { - found = key; + found = key as Uppercase; break; } } diff --git a/packages/logger/src/config/EnvironmentVariablesService.ts b/packages/logger/src/config/EnvironmentVariablesService.ts index 55188ee093..c8507a4eef 100644 --- a/packages/logger/src/config/EnvironmentVariablesService.ts +++ b/packages/logger/src/config/EnvironmentVariablesService.ts @@ -1,5 +1,5 @@ -import { ConfigServiceInterface } from '../types/ConfigServiceInterface.js'; import { EnvironmentVariablesService as CommonEnvironmentVariablesService } from '@aws-lambda-powertools/commons'; +import type { ConfigServiceInterface } from '../types/ConfigServiceInterface.js'; /** * Class EnvironmentVariablesService diff --git a/packages/logger/src/formatter/LogFormatter.ts b/packages/logger/src/formatter/LogFormatter.ts index afb3e059e7..f593e56f02 100644 --- a/packages/logger/src/formatter/LogFormatter.ts +++ b/packages/logger/src/formatter/LogFormatter.ts @@ -5,7 +5,7 @@ import type { LogFormatterOptions, } from '../types/Log.js'; import type { UnformattedAttributes } from '../types/Logger.js'; -import { LogItem } from './LogItem.js'; +import type { LogItem } from './LogItem.js'; /** * This class defines and implements common methods for the formatting of log attributes. @@ -92,9 +92,8 @@ abstract class LogFormatter implements LogFormatterInterface { const stackLines = stack.split('\n'); const regex = /\(([^)]*?):(\d+?):(\d+?)\)\\?$/; - let i; - for (i = 0; i < stackLines.length; i++) { - const match = regex.exec(stackLines[i]); + for (const item of stackLines) { + const match = regex.exec(item); if (Array.isArray(match)) { return `${match[1]}:${Number(match[2])}`; diff --git a/packages/logger/src/middleware/middy.ts b/packages/logger/src/middleware/middy.ts index 2481060145..7514da013a 100644 --- a/packages/logger/src/middleware/middy.ts +++ b/packages/logger/src/middleware/middy.ts @@ -1,10 +1,10 @@ -import { Logger } from '../Logger.js'; -import type { InjectLambdaContextOptions } from '../types/Logger.js'; import { LOGGER_KEY } from '@aws-lambda-powertools/commons'; import type { MiddlewareLikeObj, MiddyLikeRequest, } from '@aws-lambda-powertools/commons/types'; +import { Logger } from '../Logger.js'; +import type { InjectLambdaContextOptions } from '../types/Logger.js'; /** * A middy middleware that helps emitting CloudWatch EMF metrics in your logs. @@ -35,7 +35,7 @@ const injectLambdaContext = ( target: Logger | Logger[], options?: InjectLambdaContextOptions ): MiddlewareLikeObj => { - const loggers = target instanceof Array ? target : [target]; + const loggers = Array.isArray(target) ? target : [target]; const isResetStateEnabled = options && (options.clearState || options.resetKeys); @@ -54,7 +54,7 @@ const injectLambdaContext = ( const injectLambdaContextBefore = async ( request: MiddyLikeRequest ): Promise => { - loggers.forEach((logger: Logger) => { + for (const logger of loggers) { if (isResetStateEnabled) { setCleanupFunction(request); } @@ -64,14 +64,14 @@ const injectLambdaContext = ( request.context, options ); - }); + } }; const injectLambdaContextAfterOrOnError = async (): Promise => { if (isResetStateEnabled) { - loggers.forEach((logger: Logger) => { + for (const logger of loggers) { logger.resetKeys(); - }); + } } }; diff --git a/packages/logger/src/types/Log.ts b/packages/logger/src/types/Log.ts index e1ace4ef15..3326c3616b 100644 --- a/packages/logger/src/types/Log.ts +++ b/packages/logger/src/types/Log.ts @@ -1,11 +1,11 @@ import type { EnvironmentVariablesService } from '../config/EnvironmentVariablesService.js'; +import type { LogLevel as LogLevelList } from '../constants.js'; import type { LogItem } from '../formatter/LogItem.js'; import type { UnformattedAttributes } from './Logger.js'; -import { LogLevel } from '../constants.js'; type LogLevel = - | (typeof LogLevel)[keyof typeof LogLevel] - | Lowercase<(typeof LogLevel)[keyof typeof LogLevel]>; + | (typeof LogLevelList)[keyof typeof LogLevelList] + | Lowercase<(typeof LogLevelList)[keyof typeof LogLevelList]>; type LogLevelThresholds = { [key in Uppercase]: number; diff --git a/packages/logger/src/types/Logger.ts b/packages/logger/src/types/Logger.ts index 51585188d0..c08f7a9ed7 100644 --- a/packages/logger/src/types/Logger.ts +++ b/packages/logger/src/types/Logger.ts @@ -1,13 +1,13 @@ import type { HandlerMethodDecorator } from '@aws-lambda-powertools/commons/types'; +import type { Context } from 'aws-lambda'; import type { ConfigServiceInterface } from './ConfigServiceInterface.js'; import type { Environment, LogAttributes, LogAttributesWithMessage, - LogLevel, LogFormatterInterface, + LogLevel, } from './Log.js'; -import type { Context } from 'aws-lambda'; type LogFunction = { [key in Exclude, 'silent'>]: ( diff --git a/packages/logger/tests/e2e/basicFeatures.middy.test.FunctionCode.ts b/packages/logger/tests/e2e/basicFeatures.middy.test.FunctionCode.ts index cbe5e259f2..4db33bef6b 100644 --- a/packages/logger/tests/e2e/basicFeatures.middy.test.FunctionCode.ts +++ b/packages/logger/tests/e2e/basicFeatures.middy.test.FunctionCode.ts @@ -1,8 +1,8 @@ +import type { APIGatewayAuthorizerResult, Context } from 'aws-lambda'; +import middy from 'middy5'; import { Logger } from '../../src/index.js'; import { injectLambdaContext } from '../../src/middleware/middy.js'; -import type { Context, APIGatewayAuthorizerResult } from 'aws-lambda'; import type { TestEvent, TestOutput } from '../helpers/types.js'; -import middy from 'middy5'; const PERSISTENT_KEY = process.env.PERSISTENT_KEY || 'persistentKey'; const PERSISTENT_VALUE = process.env.PERSISTENT_VALUE || 'persistentValue'; diff --git a/packages/logger/tests/e2e/basicFeatures.middy.test.ts b/packages/logger/tests/e2e/basicFeatures.middy.test.ts index efdb9668ed..086e31c7a7 100644 --- a/packages/logger/tests/e2e/basicFeatures.middy.test.ts +++ b/packages/logger/tests/e2e/basicFeatures.middy.test.ts @@ -3,13 +3,13 @@ * * @group e2e/logger/basicFeatures */ +import { join } from 'node:path'; import { - invokeFunction, TestInvocationLogs, TestStack, + invokeFunction, } from '@aws-lambda-powertools/testing-utils'; import type { APIGatewayAuthorizerResult } from 'aws-lambda'; -import { join } from 'node:path'; import { LoggerTestNodejsFunction } from '../helpers/resources.js'; import { RESOURCE_NAME_PREFIX, @@ -21,7 +21,7 @@ import { commonEnvironmentVars, } from './constants.js'; -describe(`Logger E2E tests, basic functionalities middy usage`, () => { +describe('Logger E2E tests, basic functionalities middy usage', () => { const testStack = new TestStack({ stackNameProps: { stackNamePrefix: RESOURCE_NAME_PREFIX, diff --git a/packages/logger/tests/e2e/childLogger.manual.test.FunctionCode.ts b/packages/logger/tests/e2e/childLogger.manual.test.FunctionCode.ts index 82c2b3f0c2..f7ba75b2a4 100644 --- a/packages/logger/tests/e2e/childLogger.manual.test.FunctionCode.ts +++ b/packages/logger/tests/e2e/childLogger.manual.test.FunctionCode.ts @@ -1,7 +1,7 @@ -import { Logger } from '../../src/index.js'; import type { Context } from 'aws-lambda'; +import { Logger } from '../../src/index.js'; import type { LogLevel } from '../../src/types/index.js'; -import { TestEvent, TestOutput } from '../helpers/types.js'; +import type { TestEvent, TestOutput } from '../helpers/types.js'; const PERSISTENT_KEY = process.env.PERSISTENT_KEY || 'persistentKey'; const PERSISTENT_VALUE = process.env.ERSISTENT_VALUE || 'persistentValue'; diff --git a/packages/logger/tests/e2e/childLogger.manual.test.ts b/packages/logger/tests/e2e/childLogger.manual.test.ts index 037b3ac81d..3fe16a9446 100644 --- a/packages/logger/tests/e2e/childLogger.manual.test.ts +++ b/packages/logger/tests/e2e/childLogger.manual.test.ts @@ -3,23 +3,23 @@ * * @group e2e/logger/childLogger */ +import { join } from 'node:path'; import { - invokeFunction, TestInvocationLogs, TestStack, + invokeFunction, } from '@aws-lambda-powertools/testing-utils'; -import { join } from 'node:path'; import { LoggerTestNodejsFunction } from '../helpers/resources.js'; import { - commonEnvironmentVars, RESOURCE_NAME_PREFIX, SETUP_TIMEOUT, STACK_OUTPUT_LOG_GROUP, TEARDOWN_TIMEOUT, TEST_CASE_TIMEOUT, + commonEnvironmentVars, } from './constants.js'; -describe(`Logger E2E tests, child logger`, () => { +describe('Logger E2E tests, child logger', () => { const testStack = new TestStack({ stackNameProps: { stackNamePrefix: RESOURCE_NAME_PREFIX, diff --git a/packages/logger/tests/e2e/logEventEnvVarSetting.middy.test.FunctionCode.ts b/packages/logger/tests/e2e/logEventEnvVarSetting.middy.test.FunctionCode.ts index 140b20f6f8..f09f646999 100644 --- a/packages/logger/tests/e2e/logEventEnvVarSetting.middy.test.FunctionCode.ts +++ b/packages/logger/tests/e2e/logEventEnvVarSetting.middy.test.FunctionCode.ts @@ -1,8 +1,8 @@ +import type { Context } from 'aws-lambda'; +import middy from 'middy4'; import { Logger } from '../../src/index.js'; import { injectLambdaContext } from '../../src/middleware/middy.js'; import type { TestEvent, TestOutput } from '../helpers/types.js'; -import type { Context } from 'aws-lambda'; -import middy from 'middy4'; const logger = new Logger(); diff --git a/packages/logger/tests/e2e/logEventEnvVarSetting.middy.test.ts b/packages/logger/tests/e2e/logEventEnvVarSetting.middy.test.ts index 902c41c09e..32656be427 100644 --- a/packages/logger/tests/e2e/logEventEnvVarSetting.middy.test.ts +++ b/packages/logger/tests/e2e/logEventEnvVarSetting.middy.test.ts @@ -3,12 +3,12 @@ * * @group e2e/logger/logEventEnvVarSetting */ +import { join } from 'node:path'; import { - invokeFunction, TestInvocationLogs, TestStack, + invokeFunction, } from '@aws-lambda-powertools/testing-utils'; -import { join } from 'node:path'; import { LoggerTestNodejsFunction } from '../helpers/resources.js'; import { RESOURCE_NAME_PREFIX, @@ -18,7 +18,7 @@ import { TEST_CASE_TIMEOUT, } from './constants.js'; -describe(`Logger E2E tests, log event via env var setting with middy`, () => { +describe('Logger E2E tests, log event via env var setting with middy', () => { const testStack = new TestStack({ stackNameProps: { stackNamePrefix: RESOURCE_NAME_PREFIX, diff --git a/packages/logger/tests/e2e/sampleRate.decorator.test.FunctionCode.ts b/packages/logger/tests/e2e/sampleRate.decorator.test.FunctionCode.ts index 2ccedbe94f..bc770fe560 100644 --- a/packages/logger/tests/e2e/sampleRate.decorator.test.FunctionCode.ts +++ b/packages/logger/tests/e2e/sampleRate.decorator.test.FunctionCode.ts @@ -1,9 +1,9 @@ +import type { LambdaInterface } from '@aws-lambda-powertools/commons/types'; +import type { Context } from 'aws-lambda'; import { Logger } from '../../src/index.js'; import type { TestEvent, TestOutput } from '../helpers/types.js'; -import type { Context } from 'aws-lambda'; -import type { LambdaInterface } from '@aws-lambda-powertools/commons/types'; -const SAMPLE_RATE = parseFloat(process.env.SAMPLE_RATE || '0.1'); +const SAMPLE_RATE = Number.parseFloat(process.env.SAMPLE_RATE || '0.1'); const LOG_MSG = process.env.LOG_MSG || 'Hello World'; const logger = new Logger({ diff --git a/packages/logger/tests/e2e/sampleRate.decorator.test.ts b/packages/logger/tests/e2e/sampleRate.decorator.test.ts index ff4b5fae30..56f59f266b 100644 --- a/packages/logger/tests/e2e/sampleRate.decorator.test.ts +++ b/packages/logger/tests/e2e/sampleRate.decorator.test.ts @@ -3,13 +3,13 @@ * * @group e2e/logger/sampleRate */ +import { randomUUID } from 'node:crypto'; +import { join } from 'node:path'; import { - invokeFunction, TestInvocationLogs, TestStack, + invokeFunction, } from '@aws-lambda-powertools/testing-utils'; -import { randomUUID } from 'node:crypto'; -import { join } from 'node:path'; import { LoggerTestNodejsFunction } from '../helpers/resources.js'; import { RESOURCE_NAME_PREFIX, @@ -19,7 +19,7 @@ import { TEST_CASE_TIMEOUT, } from './constants.js'; -describe(`Logger E2E tests, sample rate and injectLambdaContext()`, () => { +describe('Logger E2E tests, sample rate and injectLambdaContext()', () => { const testStack = new TestStack({ stackNameProps: { stackNamePrefix: RESOURCE_NAME_PREFIX, diff --git a/packages/logger/tests/helpers/resources.ts b/packages/logger/tests/helpers/resources.ts index deef695c0a..e7db1993e4 100644 --- a/packages/logger/tests/helpers/resources.ts +++ b/packages/logger/tests/helpers/resources.ts @@ -1,10 +1,10 @@ -import { TestNodejsFunction } from '@aws-lambda-powertools/testing-utils/resources/lambda'; import type { TestStack } from '@aws-lambda-powertools/testing-utils'; -import { CfnOutput } from 'aws-cdk-lib'; +import { TestNodejsFunction } from '@aws-lambda-powertools/testing-utils/resources/lambda'; import type { ExtraTestProps, TestNodejsFunctionProps, } from '@aws-lambda-powertools/testing-utils/types'; +import { CfnOutput } from 'aws-cdk-lib'; import { commonEnvironmentVars } from '../e2e/constants'; interface LoggerExtraTestProps extends ExtraTestProps { diff --git a/packages/logger/tests/unit/Logger.test.ts b/packages/logger/tests/unit/Logger.test.ts index db12665f08..447e2b9786 100644 --- a/packages/logger/tests/unit/Logger.test.ts +++ b/packages/logger/tests/unit/Logger.test.ts @@ -3,23 +3,23 @@ * * @group unit/logger/logger */ -import context from '@aws-lambda-powertools/testing-utils/context'; import type { LambdaInterface } from '@aws-lambda-powertools/commons/types'; -import { Logger, LogFormatter, LogLevel } from '../../src/index.js'; -import { ConfigServiceInterface } from '../../src/types/ConfigServiceInterface.js'; +import context from '@aws-lambda-powertools/testing-utils/context'; +import type { Context } from 'aws-lambda'; import { EnvironmentVariablesService } from '../../src/config/EnvironmentVariablesService.js'; +import { LogJsonIndent } from '../../src/constants.js'; import { PowertoolsLogFormatter } from '../../src/formatter/PowertoolsLogFormatter.js'; -import { +import { LogFormatter, LogLevel, Logger } from '../../src/index.js'; +import type { ConfigServiceInterface } from '../../src/types/ConfigServiceInterface.js'; +import type { LogLevelThresholds, - type LogLevel as LogLevelType, + LogLevel as LogLevelType, } from '../../src/types/Log.js'; -import { - type LogFunction, - type ConstructorOptions, - type CustomJsonReplacerFn, +import type { + ConstructorOptions, + CustomJsonReplacerFn, + LogFunction, } from '../../src/types/Logger.js'; -import { LogJsonIndent } from '../../src/constants.js'; -import type { Context } from 'aws-lambda'; const mockDate = new Date(1466424490000); const dateSpy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate); @@ -140,8 +140,8 @@ describe('Class: Logger', () => { test('when no constructor parameters and no environment variables are set, returns a Logger instance with the default properties', () => { // Prepare const loggerOptions = undefined; - delete process.env.POWERTOOLS_SERVICE_NAME; - delete process.env.POWERTOOLS_LOG_LEVEL; + process.env.POWERTOOLS_SERVICE_NAME = undefined; + process.env.POWERTOOLS_LOG_LEVEL = undefined; // Act const logger = new Logger(loggerOptions); @@ -292,7 +292,7 @@ describe('Class: Logger', () => { test('when no log level is set, returns a Logger instance with INFO level', () => { // Prepare const loggerOptions: ConstructorOptions = {}; - delete process.env.POWERTOOLS_LOG_LEVEL; + process.env.POWERTOOLS_LOG_LEVEL = undefined; // Act const logger = new Logger(loggerOptions); @@ -604,6 +604,7 @@ describe('Class: Logger', () => { logLevel: LogLevel.DEBUG, }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(method) ); @@ -633,6 +634,7 @@ describe('Class: Logger', () => { logLevel: 'INFO', }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -662,6 +664,7 @@ describe('Class: Logger', () => { logLevel: LogLevel.WARN, }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -691,6 +694,7 @@ describe('Class: Logger', () => { logLevel: 'ERROR', }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -720,6 +724,7 @@ describe('Class: Logger', () => { logLevel: LogLevel.SILENT, }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -735,6 +740,7 @@ describe('Class: Logger', () => { process.env.POWERTOOLS_LOG_LEVEL = methodOfLogger.toUpperCase(); const logger = new Logger(); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -765,6 +771,7 @@ describe('Class: Logger', () => { sampleRateValue: 0, }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -786,6 +793,7 @@ describe('Class: Logger', () => { sampleRateValue: 1, }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -813,78 +821,70 @@ describe('Class: Logger', () => { }); describe('Feature: inject context', () => { - test( - 'when the Lambda context is not captured and a string is passed as log message, it should print a valid ' + - method.toUpperCase() + - ' log', - () => { - // Prepare - const logger = new Logger(); - const consoleSpy = jest.spyOn( - logger['console'], - getConsoleMethod(methodOfLogger) - ); - // Act - if (logger[methodOfLogger]) { - logger[methodOfLogger]('foo'); - } - - // Assess - expect(consoleSpy).toBeCalledTimes(1); - expect(consoleSpy).toHaveBeenNthCalledWith( - 1, - JSON.stringify({ - level: method.toUpperCase(), - message: 'foo', - sampling_rate: 0, - service: 'hello-world', - timestamp: '2016-06-20T12:08:10.000Z', - xray_trace_id: '1-5759e988-bd862e3fe1be46a994272793', - }) - ); + test(`when the Lambda context is not captured and a string is passed as log message, it should print a valid ${method.toUpperCase()} log`, () => { + // Prepare + const logger = new Logger(); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + getConsoleMethod(methodOfLogger) + ); + // Act + if (logger[methodOfLogger]) { + logger[methodOfLogger]('foo'); } - ); - test( - 'when the Lambda context is captured, it returns a valid ' + - method.toUpperCase() + - ' log', - () => { - // Prepare - const logger = new Logger({ - logLevel: 'DEBUG', - }); - logger.addContext(context); - const consoleSpy = jest.spyOn( - logger['console'], - getConsoleMethod(methodOfLogger) - ); - // Act - if (logger[methodOfLogger]) { - logger[methodOfLogger]('foo'); - } + // Assess + expect(consoleSpy).toBeCalledTimes(1); + expect(consoleSpy).toHaveBeenNthCalledWith( + 1, + JSON.stringify({ + level: method.toUpperCase(), + message: 'foo', + sampling_rate: 0, + service: 'hello-world', + timestamp: '2016-06-20T12:08:10.000Z', + xray_trace_id: '1-5759e988-bd862e3fe1be46a994272793', + }) + ); + }); - // Assess - expect(consoleSpy).toBeCalledTimes(1); - expect(consoleSpy).toHaveBeenNthCalledWith( - 1, - JSON.stringify({ - cold_start: true, - function_arn: - 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', - function_memory_size: '128', - function_name: 'foo-bar-function', - function_request_id: 'c6af9ac6-7b61-11e6-9a41-93e812345678', - level: method.toUpperCase(), - message: 'foo', - sampling_rate: 0, - service: 'hello-world', - timestamp: '2016-06-20T12:08:10.000Z', - xray_trace_id: '1-5759e988-bd862e3fe1be46a994272793', - }) - ); + test(`when the Lambda context is captured, it returns a valid ${method.toUpperCase()} log`, () => { + // Prepare + const logger = new Logger({ + logLevel: 'DEBUG', + }); + logger.addContext(context); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + getConsoleMethod(methodOfLogger) + ); + // Act + if (logger[methodOfLogger]) { + logger[methodOfLogger]('foo'); } - ); + + // Assess + expect(consoleSpy).toBeCalledTimes(1); + expect(consoleSpy).toHaveBeenNthCalledWith( + 1, + JSON.stringify({ + cold_start: true, + function_arn: + 'arn:aws:lambda:eu-west-1:123456789012:function:foo-bar-function', + function_memory_size: '128', + function_name: 'foo-bar-function', + function_request_id: 'c6af9ac6-7b61-11e6-9a41-93e812345678', + level: method.toUpperCase(), + message: 'foo', + sampling_rate: 0, + service: 'hello-world', + timestamp: '2016-06-20T12:08:10.000Z', + xray_trace_id: '1-5759e988-bd862e3fe1be46a994272793', + }) + ); + }); }); describe('Feature: ephemeral log attributes', () => { @@ -1082,6 +1082,7 @@ describe('Class: Logger', () => { ({ idx, inputs, expected }) => { // Prepare const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1108,6 +1109,7 @@ describe('Class: Logger', () => { }, }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1141,6 +1143,7 @@ describe('Class: Logger', () => { logLevel: 'DEBUG', }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1166,11 +1169,12 @@ describe('Class: Logger', () => { test('when the `_X_AMZN_TRACE_ID` environment variable is NOT set it parses it correctly and adds the Trace ID to the log', () => { // Prepare - delete process.env._X_AMZN_TRACE_ID; + process.env._X_AMZN_TRACE_ID = undefined; const logger = new Logger({ logLevel: 'DEBUG', }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1201,6 +1205,7 @@ describe('Class: Logger', () => { logLevel: 'DEBUG', }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1243,7 +1248,11 @@ describe('Class: Logger', () => { test('when a logged item has BigInt value, it does not throw TypeError', () => { // Prepare const logger = new Logger(); - jest.spyOn(logger['console'], getConsoleMethod(methodOfLogger)); + jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + getConsoleMethod(methodOfLogger) + ); const message = `This is an ${methodOfLogger} log with BigInt value`; const logItem = { value: BigInt(42) }; const errorMessage = 'Do not know how to serialize a BigInt'; @@ -1258,6 +1267,7 @@ describe('Class: Logger', () => { // Prepare const logger = new Logger(); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1287,6 +1297,7 @@ describe('Class: Logger', () => { // Prepare const logger = new Logger(); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1326,6 +1337,7 @@ describe('Class: Logger', () => { const logger = new Logger({ jsonReplacerFn }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1367,6 +1379,7 @@ describe('Class: Logger', () => { const logger = new Logger({ jsonReplacerFn }); const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing logger['console'], getConsoleMethod(methodOfLogger) ); @@ -1570,7 +1583,11 @@ describe('Class: Logger', () => { aws_account_id: '0987654321', }); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.info('This is an INFO log with some log attributes'); @@ -1828,7 +1845,11 @@ describe('Class: Logger', () => { aws_region: 'eu-west-1', }, }); - const debugSpy = jest.spyOn(logger['console'], 'info'); + const debugSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); logger.appendKeys({ aws_region: 'us-east-1', }); @@ -1903,7 +1924,11 @@ describe('Class: Logger', () => { it('overwrites existing temporary keys with new ones in the next log', () => { // Prepare const logger = new Logger(); - const debugSpy = jest.spyOn(logger['console'], 'info'); + const debugSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); logger.appendKeys({ aws_account_id: '123456789012', }); @@ -1931,7 +1956,11 @@ describe('Class: Logger', () => { // Prepare const logger = new Logger(); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext() public async handler( @@ -1975,7 +2004,11 @@ describe('Class: Logger', () => { test('it captures Lambda context information and adds it in the printed logs', async () => { // Prepare const logger = new Logger(); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext() public async handler( @@ -2029,7 +2062,11 @@ describe('Class: Logger', () => { // Prepare const expectedReturnValue = 'Lambda invoked!'; const logger = new Logger(); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext() public async handler( @@ -2092,7 +2129,11 @@ describe('Class: Logger', () => { biz: 'baz', }); - const debugSpy = jest.spyOn(logger['console'], 'debug'); + const debugSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'debug' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext({ clearState: true }) @@ -2209,7 +2250,11 @@ describe('Class: Logger', () => { logLevel: 'DEBUG', }); - const debugSpy = jest.spyOn(logger['console'], 'debug'); + const debugSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'debug' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext({ clearState: true }) @@ -2286,7 +2331,11 @@ describe('Class: Logger', () => { logLevel: 'DEBUG', }); - const debugSpy = jest.spyOn(logger['console'], 'debug'); + const debugSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'debug' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext({ clearState: true }) @@ -2352,7 +2401,11 @@ describe('Class: Logger', () => { const logger = new Logger({ logLevel: LogLevel.DEBUG, }); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext({ logEvent: true }) public async handler( @@ -2399,7 +2452,11 @@ describe('Class: Logger', () => { const logger = new Logger({ logLevel: 'DEBUG', }); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext() public async handler( @@ -2445,7 +2502,11 @@ describe('Class: Logger', () => { const logger = new Logger({ logLevel: 'DEBUG', }); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); class LambdaFunction implements LambdaInterface { private readonly memberVariable: string; @@ -2500,7 +2561,11 @@ describe('Class: Logger', () => { logLevel: 'DEBUG', }); const resetKeysSpy = jest.spyOn(logger, 'resetKeys'); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext({ clearState: true }) public async handler( @@ -2540,7 +2605,11 @@ describe('Class: Logger', () => { version: '1.0.0', }, }); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); class LambdaFunction implements LambdaInterface { @logger.injectLambdaContext({ clearState: true, logEvent: true }) public async handler( @@ -3027,7 +3096,11 @@ describe('Class: Logger', () => { test('When the feature is disabled, it DOES NOT log the event', () => { // Prepare const logger = new Logger(); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.logEventIfEnabled(event); @@ -3041,7 +3114,11 @@ describe('Class: Logger', () => { something: 'happened!', }; const logger = new Logger(); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.logEventIfEnabled(event, true); @@ -3097,7 +3174,11 @@ describe('Class: Logger', () => { test('when the `POWERTOOLS_DEV` env var is NOT SET it makes log output as one-liner', () => { // Prepare const logger = new Logger(); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.info('Message without pretty identation'); @@ -3278,7 +3359,11 @@ describe('Class: Logger', () => { customConfigService: new MyCustomEnvironmentVariablesService(), }; const logger: Logger = new Logger(loggerOptions); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.info('foo'); @@ -3311,7 +3396,11 @@ describe('Class: Logger', () => { customConfigService: new MyCustomEnvironmentVariablesService(), }; const logger: Logger = new Logger(loggerOptions); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.info('foo'); @@ -3334,7 +3423,11 @@ describe('Class: Logger', () => { // Prepare process.env.POWERTOOLS_LOGGER_SAMPLE_RATE = '1'; const logger: Logger = new Logger(); - const consoleSpy = jest.spyOn(logger['console'], 'debug'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'debug' + ); // Act logger.debug('foo'); @@ -3377,7 +3470,11 @@ describe('Class: Logger', () => { }; const logger: Logger = new Logger(loggerOptions); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.info('foo'); @@ -3402,7 +3499,11 @@ describe('Class: Logger', () => { logLevel: LogLevel.INFO, sampleRateValue: 42, }); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.info('foo'); @@ -3435,7 +3536,11 @@ describe('Class: Logger', () => { }; const logger: Logger = new Logger(loggerOptions); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.info('foo'); @@ -3460,7 +3565,11 @@ describe('Class: Logger', () => { const logger: Logger = new Logger({ logLevel: 'INFO', }); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.info('foo'); @@ -3504,7 +3613,11 @@ describe('Class: Logger', () => { logLevel: LogLevel.INFO, sampleRateValue: 1, }); - const consoleSpy = jest.spyOn(logger['console'], 'info'); + const consoleSpy = jest.spyOn( + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing + logger['console'], + 'info' + ); // Act logger.refreshSampleRateCalculation(); logger.info('foo'); diff --git a/packages/logger/tests/unit/formatter/PowertoolsLogFormatter.test.ts b/packages/logger/tests/unit/formatter/PowertoolsLogFormatter.test.ts index aa33c7368e..81fb7c7aeb 100644 --- a/packages/logger/tests/unit/formatter/PowertoolsLogFormatter.test.ts +++ b/packages/logger/tests/unit/formatter/PowertoolsLogFormatter.test.ts @@ -4,11 +4,11 @@ * @group unit/logger/logFormatter */ import { AssertionError } from 'node:assert'; +import { EnvironmentVariablesService } from '../../../src/config/EnvironmentVariablesService.js'; import { PowertoolsLogFormatter } from '../../../src/formatter/PowertoolsLogFormatter.js'; import { LogItem } from '../../../src/index.js'; -import type { UnformattedAttributes } from '../../../src/types/Logger.js'; import type { LogAttributes } from '../../../src/types/Log.js'; -import { EnvironmentVariablesService } from '../../../src/config/EnvironmentVariablesService.js'; +import type { UnformattedAttributes } from '../../../src/types/Logger.js'; describe('Class: PowertoolsLogFormatter', () => { const ENVIRONMENT_VARIABLES = process.env; diff --git a/packages/logger/tests/unit/middleware/middy.test.ts b/packages/logger/tests/unit/middleware/middy.test.ts index eb9c9a7932..2d31d575c1 100644 --- a/packages/logger/tests/unit/middleware/middy.test.ts +++ b/packages/logger/tests/unit/middleware/middy.test.ts @@ -8,7 +8,7 @@ import context from '@aws-lambda-powertools/testing-utils/context'; import middy from '@middy/core'; import type { Context } from 'aws-lambda'; import { injectLambdaContext } from '../../../src/middleware/middy.js'; -import { ConfigServiceInterface } from '../../../src/types/ConfigServiceInterface.js'; +import type { ConfigServiceInterface } from '../../../src/types/ConfigServiceInterface.js'; import { Logger } from './../../../src/Logger.js'; const mockDate = new Date(1466424490000); @@ -107,6 +107,7 @@ describe('Middy middleware', () => { biz: 'baz', }); + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing const debugSpy = jest.spyOn(logger['console'], 'debug'); const handler = middy((): void => { @@ -174,6 +175,7 @@ describe('Middy middleware', () => { biz: 'baz', }); + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing const debugSpy = jest.spyOn(logger['console'], 'debug'); const handler = middy((): void => { @@ -314,6 +316,7 @@ describe('Middy middleware', () => { const logger = new Logger({ logLevel: 'DEBUG', }); + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing const loggerSpy = jest.spyOn(logger['console'], 'debug'); const myCustomMiddleware = (): middy.MiddlewareObj => { const before = async ( @@ -371,6 +374,7 @@ describe('Middy middleware', () => { // Prepare const logger = new Logger(); const consoleSpy = jest + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing .spyOn(logger['console'], 'info') .mockImplementation(); const handler = middy((): void => { @@ -447,6 +451,7 @@ describe('Middy middleware', () => { customConfigService: configService, }); const consoleSpy = jest + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing .spyOn(logger['console'], 'info') .mockImplementation(); const handler = middy((): void => { @@ -486,6 +491,7 @@ describe('Middy middleware', () => { process.env.POWERTOOLS_LOGGER_LOG_EVENT = 'true'; const logger = new Logger(); const consoleSpy = jest + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing .spyOn(logger['console'], 'info') .mockImplementation(); const handler = middy((): void => { @@ -525,6 +531,7 @@ describe('Middy middleware', () => { process.env.POWERTOOLS_LOGGER_LOG_EVENT = 'true'; const logger = new Logger(); const consoleSpy = jest + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing .spyOn(logger['console'], 'info') .mockImplementation(); const handler = middy((): void => { @@ -562,6 +569,7 @@ describe('Middy middleware', () => { }, }); const consoleSpy = jest + // biome-ignore lint/complexity/useLiteralKeys: This needs to be accessed with literal key for testing .spyOn(logger['console'], 'info') .mockImplementation(); const handler = middy( diff --git a/packages/logger/tsconfig.esm.json b/packages/logger/tsconfig.esm.json index 123291b0cf..82486b64fa 100644 --- a/packages/logger/tsconfig.esm.json +++ b/packages/logger/tsconfig.esm.json @@ -6,7 +6,5 @@ "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json" }, - "include": [ - "./src/**/*" - ] -} \ No newline at end of file + "include": ["./src/**/*"] +} diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json index d56a564ef6..4923c4f6f4 100644 --- a/packages/logger/tsconfig.json +++ b/packages/logger/tsconfig.json @@ -5,7 +5,5 @@ "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/cjs.json" }, - "include": [ - "./src/**/*" - ] -} \ No newline at end of file + "include": ["./src/**/*"] +}