Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aws-lambda-powertools/logger

Package Overview
Dependencies
Maintainers
9
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-lambda-powertools/logger - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0

42

lib/config/ConfigService.d.ts
import { ConfigServiceInterface } from '.';
/**
* Abstract class ConfigService
*
* This class defines common methods and variables that can be set by the developer
* in the runtime.
*
* @class
* @abstract
* @implements {ConfigServiceInterface}
* @see https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/#environment-variables
*/
declare abstract class ConfigService implements ConfigServiceInterface {
/**
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/#environment-variables
* @protected
*/
protected currentEnvironmentVariable: string;

@@ -7,8 +23,34 @@ protected logLevelVariable: string;

protected serviceNameVariable: string;
/**
* It returns the value of an environment variable that has given name.
*
* @param {string} name
* @returns {string}
*/
abstract get(name: string): string;
/**
* It returns the value of the ENVIRONMENT environment variable.
*
* @returns {string}
*/
abstract getCurrentEnvironment(): string;
/**
* It returns the value of the LOG_LEVEL environment variable.
*
* @returns {string}
*/
abstract getLogLevel(): string;
/**
* It returns the value of the POWERTOOLS_LOGGER_SAMPLE_RATE environment variable.
*
* @returns {string|undefined}
*/
abstract getSampleRateValue(): number | undefined;
/**
* It returns the value of the POWERTOOLS_SERVICE_NAME environment variable.
*
* @returns {string}
*/
abstract getServiceName(): string;
}
export { ConfigService, };

19

lib/config/ConfigService.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigService = void 0;
/**
* Abstract class ConfigService
*
* This class defines common methods and variables that can be set by the developer
* in the runtime.
*
* @class
* @abstract
* @implements {ConfigServiceInterface}
* @see https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/#environment-variables
*/
class ConfigService {
constructor() {
// Custom environment variables
/**
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/#environment-variables
* @protected
*/
this.currentEnvironmentVariable = 'ENVIRONMENT';

@@ -14,2 +29,2 @@ this.logLevelVariable = 'LOG_LEVEL';

exports.ConfigService = ConfigService;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uZmlnU2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvQ29uZmlnU2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxNQUFlLGFBQWE7SUFBNUI7UUFFRSwrQkFBK0I7UUFDckIsK0JBQTBCLEdBQUcsYUFBYSxDQUFDO1FBQzNDLHFCQUFnQixHQUFHLFdBQVcsQ0FBQztRQUMvQiw0QkFBdUIsR0FBRywrQkFBK0IsQ0FBQztRQUMxRCx3QkFBbUIsR0FBRyx5QkFBeUIsQ0FBQztJQVk1RCxDQUFDO0NBQUE7QUFHQyxzQ0FBYSJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uZmlnU2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25maWcvQ29uZmlnU2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQTs7Ozs7Ozs7Ozs7R0FXRztBQUNILE1BQWUsYUFBYTtJQUE1QjtRQUVFOzs7V0FHRztRQUNPLCtCQUEwQixHQUFHLGFBQWEsQ0FBQztRQUMzQyxxQkFBZ0IsR0FBRyxXQUFXLENBQUM7UUFDL0IsNEJBQXVCLEdBQUcsK0JBQStCLENBQUM7UUFDMUQsd0JBQW1CLEdBQUcseUJBQXlCLENBQUM7SUFzQzVELENBQUM7Q0FBQTtBQUdDLHNDQUFhIn0=

@@ -0,8 +1,41 @@

/**
* Interface ConfigServiceInterface
*
* @interface
* @see https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/#environment-variables
*/
interface ConfigServiceInterface {
/**
* It returns the value of an environment variable that has given name.
*
* @param {string} name
* @returns {string}
*/
get(name: string): string;
/**
* It returns the value of the ENVIRONMENT environment variable.
*
* @returns {string}
*/
getCurrentEnvironment(): string;
/**
* It returns the value of the LOG_LEVEL environment variable.
*
* @returns {string}
*/
getLogLevel(): string;
/**
* It returns the value of the POWERTOOLS_LOGGER_SAMPLE_RATE environment variable.
*
* @returns {string|undefined}
*/
getSampleRateValue(): number | undefined;
/**
* It returns the value of the POWERTOOLS_SERVICE_NAME environment variable.
*
* @returns {string}
*/
getServiceName(): string;
}
export { ConfigServiceInterface, };
import { ConfigService } from '.';
/**
* Class EnvironmentVariablesService
*
* This class is used to return environment variables that are available in the runtime of
* the current Lambda invocation.
* These variables can be a mix of runtime environment variables set by AWS and
* variables that can be set by the developer additionally.
*
* @class
* @extends {ConfigService}
* @see https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/#environment-variables
*/
declare class EnvironmentVariablesService extends ConfigService {

@@ -8,13 +21,64 @@ private awsRegionVariable;

private xRayTraceIdVariable;
/**
* It returns the value of an environment variable that has given name.
*
* @param {string} name
* @returns {string}
*/
get(name: string): string;
/**
* It returns the value of the AWS_REGION environment variable.
*
* @returns {string}
*/
getAwsRegion(): string;
/**
* It returns the value of the ENVIRONMENT environment variable.
*
* @returns {string}
*/
getCurrentEnvironment(): string;
/**
* It returns the value of the AWS_LAMBDA_FUNCTION_MEMORY_SIZE environment variable.
*
* @returns {string}
*/
getFunctionMemory(): number;
/**
* It returns the value of the AWS_LAMBDA_FUNCTION_NAME environment variable.
*
* @returns {string}
*/
getFunctionName(): string;
/**
* It returns the value of the AWS_LAMBDA_FUNCTION_VERSION environment variable.
*
* @returns {string}
*/
getFunctionVersion(): string;
/**
* It returns the value of the LOG_LEVEL environment variable.
*
* @returns {string}
*/
getLogLevel(): string;
/**
* It returns the value of the POWERTOOLS_LOGGER_SAMPLE_RATE environment variable.
*
* @returns {string|undefined}
*/
getSampleRateValue(): number | undefined;
/**
* It returns the value of the POWERTOOLS_SERVICE_NAME environment variable.
*
* @returns {string}
*/
getServiceName(): string;
/**
* It returns the value of the _X_AMZN_TRACE_ID environment variable.
*
* @returns {string}
*/
getXrayTraceId(): string;
}
export { EnvironmentVariablesService, };

@@ -5,2 +5,15 @@ "use strict";

const _1 = require(".");
/**
* Class EnvironmentVariablesService
*
* This class is used to return environment variables that are available in the runtime of
* the current Lambda invocation.
* These variables can be a mix of runtime environment variables set by AWS and
* variables that can be set by the developer additionally.
*
* @class
* @extends {ConfigService}
* @see https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/#environment-variables
*/
class EnvironmentVariablesService extends _1.ConfigService {

@@ -16,11 +29,32 @@ constructor() {

}
/**
* It returns the value of an environment variable that has given name.
*
* @param {string} name
* @returns {string}
*/
get(name) {
return process.env[name]?.trim() || '';
}
/**
* It returns the value of the AWS_REGION environment variable.
*
* @returns {string}
*/
getAwsRegion() {
return this.get(this.awsRegionVariable);
}
/**
* It returns the value of the ENVIRONMENT environment variable.
*
* @returns {string}
*/
getCurrentEnvironment() {
return this.get(this.currentEnvironmentVariable);
}
/**
* It returns the value of the AWS_LAMBDA_FUNCTION_MEMORY_SIZE environment variable.
*
* @returns {string}
*/
getFunctionMemory() {

@@ -30,11 +64,31 @@ const value = this.get(this.memoryLimitInMBVariable);

}
/**
* It returns the value of the AWS_LAMBDA_FUNCTION_NAME environment variable.
*
* @returns {string}
*/
getFunctionName() {
return this.get(this.functionNameVariable);
}
/**
* It returns the value of the AWS_LAMBDA_FUNCTION_VERSION environment variable.
*
* @returns {string}
*/
getFunctionVersion() {
return this.get(this.functionVersionVariable);
}
/**
* It returns the value of the LOG_LEVEL environment variable.
*
* @returns {string}
*/
getLogLevel() {
return this.get(this.logLevelVariable);
}
/**
* It returns the value of the POWERTOOLS_LOGGER_SAMPLE_RATE environment variable.
*
* @returns {string|undefined}
*/
getSampleRateValue() {

@@ -44,5 +98,15 @@ const value = this.get(this.sampleRateValueVariable);

}
/**
* It returns the value of the POWERTOOLS_SERVICE_NAME environment variable.
*
* @returns {string}
*/
getServiceName() {
return this.get(this.serviceNameVariable);
}
/**
* It returns the value of the _X_AMZN_TRACE_ID environment variable.
*
* @returns {string}
*/
getXrayTraceId() {

@@ -53,2 +117,2 @@ return this.get(this.xRayTraceIdVariable);

exports.EnvironmentVariablesService = EnvironmentVariablesService;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRW52aXJvbm1lbnRWYXJpYWJsZXNTZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbmZpZy9FbnZpcm9ubWVudFZhcmlhYmxlc1NlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsd0JBQWtDO0FBRWxDLE1BQU0sMkJBQTRCLFNBQVEsZ0JBQWE7SUFBdkQ7O1FBRUUsaUNBQWlDO1FBQ3pCLHNCQUFpQixHQUFHLFlBQVksQ0FBQztRQUNqQyx5QkFBb0IsR0FBRywwQkFBMEIsQ0FBQztRQUNsRCw0QkFBdUIsR0FBRyw2QkFBNkIsQ0FBQztRQUN4RCw0QkFBdUIsR0FBRyxpQ0FBaUMsQ0FBQztRQUM1RCx3QkFBbUIsR0FBRyxrQkFBa0IsQ0FBQztJQThDbkQsQ0FBQztJQTVDUSxHQUFHLENBQUMsSUFBWTtRQUNyQixPQUFPLE9BQU8sQ0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7T0FJRztJQUNJLGNBQWM7UUFDbkIsT0FBTyxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDO0lBQzVDLENBQUM7SUFFRDs7OztPQUlHO0lBQ0ksY0FBYztRQUNuQixPQUFPLElBQUksQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLG1CQUFtQixDQUFDLENBQUM7SUFDNUMsQ0FBQztDQUVGO0FBR0Msa0VBQTJCIn0=
import { LogFormatterInterface } from '.';
import { LogAttributes, UnformattedAttributes } from '../types';
/**
* This class defines and implements common methods for the formatting of log attributes.
*
* @class
* @abstract
* @implements {LogFormatterInterface}
*/
declare abstract class LogFormatter implements LogFormatterInterface {
/**
* It formats key-value pairs of log attributes.
*
* @param {UnformattedAttributes} attributes
* @returns {LogAttributes}
*/
abstract formatAttributes(attributes: UnformattedAttributes): LogAttributes;
/**
* It formats a given Error parameter.
*
* @param {Error} error
* @returns {LogAttributes}
*/
formatError(error: Error): LogAttributes;
/**
* It formats a date into a string in simplified extended ISO format (ISO 8601).
*
* @param {Date} now
* @returns {string}
*/
formatTimestamp(now: Date): string;
/**
* It returns a string containing the location of an error, given a particular stack trace.
*
* @param stack
* @returns {string}
*/
getCodeLocation(stack?: string): string;
}
export { LogFormatter, };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogFormatter = void 0;
/**
* This class defines and implements common methods for the formatting of log attributes.
*
* @class
* @abstract
* @implements {LogFormatterInterface}
*/
class LogFormatter {
/**
* It formats a given Error parameter.
*
* @param {Error} error
* @returns {LogAttributes}
*/
formatError(error) {

@@ -13,5 +26,17 @@ return {

}
/**
* It formats a date into a string in simplified extended ISO format (ISO 8601).
*
* @param {Date} now
* @returns {string}
*/
formatTimestamp(now) {
return now.toISOString();
}
/**
* It returns a string containing the location of an error, given a particular stack trace.
*
* @param stack
* @returns {string}
*/
getCodeLocation(stack) {

@@ -34,2 +59,2 @@ if (!stack) {

exports.LogFormatter = Log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QUNyQyxNQUFNLEtBQUssR0FBRywwQkFBMEIsQ0FBQztRQUV6QyxJQUFJLENBQUMsQ0FBQztRQUNOLEtBQUssQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEdBQUcsVUFBVSxDQUFDLE1BQU0sRUFBRSxDQUFDLEVBQUUsRUFBRTtZQUN0QyxNQUFNLEtBQUssR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO1lBRXhDLElBQUksS0FBSyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsRUFBRTtnQkFDeEIsT0FBTyxHQUFHLEtBQUssQ0FBQyxDQUFDLENBQUMsSUFBSSxNQUFNLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQzthQUMxQztTQUVGO1FBRUQsT0FBTyxFQUFFLENBQUM7SUFDWixDQUFDO0NBQ0Y7QUFHQyxvQ0FBWSJ9
import { LogAttributes, UnformattedAttributes } from '../types';
/**
* @interface
*/
interface LogFormatterInterface {
/**
* It formats key-value pairs of log attributes.
*
* @param {UnformattedAttributes} attributes
* @returns {PowertoolLog}
*/
formatAttributes(attributes: UnformattedAttributes): LogAttributes;
/**
* It formats a given Error parameter.
*
* @param {Error} error
* @returns {LogAttributes}
*/
formatError(error: Error): LogAttributes;
}
export { LogFormatterInterface, };
import { LogFormatter } from '.';
import { UnformattedAttributes } from '../types';
import { PowertoolLog } from '../types/formats';
/**
* This class is used to transform a set of log key-value pairs
* in the AWS Lambda Powertools' default structure log format.
*
* @class
* @extends {LogFormatter}
*/
declare class PowertoolLogFormatter extends LogFormatter {
/**
* It formats key-value pairs of log attributes.
*
* @param {UnformattedAttributes} attributes
* @returns {PowertoolLog}
*/
formatAttributes(attributes: UnformattedAttributes): PowertoolLog;
}
export { PowertoolLogFormatter, };

@@ -5,3 +5,16 @@ "use strict";

const _1 = require(".");
/**
* This class is used to transform a set of log key-value pairs
* in the AWS Lambda Powertools' default structure log format.
*
* @class
* @extends {LogFormatter}
*/
class PowertoolLogFormatter extends _1.LogFormatter {
/**
* It formats key-value pairs of log attributes.
*
* @param {UnformattedAttributes} attributes
* @returns {PowertoolLog}
*/
formatAttributes(attributes) {

@@ -24,2 +37,2 @@ return {

exports.PowertoolLogFormatter = PowertoolLogFormatter;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUG93ZXJ0b29sTG9nRm9ybWF0dGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Zvcm1hdHRlci9Qb3dlcnRvb2xMb2dGb3JtYXR0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsd0JBQWlDO0FBSWpDLE1BQU0scUJBQXNCLFNBQVEsZUFBWTtJQUV2QyxnQkFBZ0IsQ0FBQyxVQUFpQztRQUN2RCxPQUFPO1lBQ0wsVUFBVSxFQUFFLFVBQVUsQ0FBQyxhQUFhLEVBQUUsU0FBUztZQUMvQyxZQUFZLEVBQUUsVUFBVSxDQUFDLGFBQWEsRUFBRSxrQkFBa0I7WUFDMUQsb0JBQW9CLEVBQUUsVUFBVSxDQUFDLGFBQWEsRUFBRSxlQUFlO1lBQy9ELGFBQWEsRUFBRSxVQUFVLENBQUMsYUFBYSxFQUFFLFlBQVk7WUFDckQsbUJBQW1CLEVBQUUsVUFBVSxDQUFDLGFBQWEsRUFBRSxZQUFZO1lBQzNELEtBQUssRUFBRSxVQUFVLENBQUMsUUFBUTtZQUMxQixPQUFPLEVBQUUsVUFBVSxDQUFDLE9BQU87WUFDM0IsYUFBYSxFQUFFLFVBQVUsQ0FBQyxlQUFlO1lBQ3pDLE9BQU8sRUFBRSxVQUFVLENBQUMsV0FBVztZQUMvQixTQUFTLEVBQUUsSUFBSSxDQUFDLGVBQWUsQ0FBQyxVQUFVLENBQUMsU0FBUyxDQUFDO1lBQ3JELGFB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UFHQyxzREFBcUIifQ==
import type { Context } from 'aws-lambda';
import type { ClassThatLogs, HandlerMethodDecorator, LogAttributes, LoggerOptions, LogItemExtraInput, LogItemMessage } from './types';
/**
* ## Intro
* The Logger utility provides an opinionated logger with output structured as JSON.
*
* ## Key features
* * Capture key fields from Lambda context, cold start and structures logging output as JSON
* * Log Lambda context when instructed (disabled by default)
* * Log sampling prints all logs for a percentage of invocations (disabled by default)
* * Append additional keys to structured log at any point in time
*
* ## Usage
*
* For more usage examples, see [our documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/).
*
* ### Basic usage
*
* @example
* ```typescript
* import { Logger } from "@aws-lambda-powertools/logger";
*
* // Logger parameters fetched from the environment variables:
* const logger = new Logger();
* ```
*
* ### Functions usage with manual instrumentation
*
* If you prefer to manually instrument your Lambda handler you can use the methods in the Logger class directly.
*
* @example
* ```typescript
* import { Logger } from "@aws-lambda-powertools/logger";
*
* const logger = new Logger();
*
* export const handler = async (_event, context) => {
* logger.addContext(context);
* logger.info("This is an INFO log with some context");
* };
* ```
*
* ### Functions usage with middleware
*
* If you use function-based Lambda handlers you can use the [injectLambdaContext()](#injectLambdaContext)
* middy middleware to automatically add context to your Lambda logs.
*
* @example
* ```typescript
* import { Logger, injectLambdaContext } from "@aws-lambda-powertools/logger";
* import middy from '@middy/core';
*
* const logger = new Logger();
*
* const lambdaHandler = async (_event: any, _context: any) => {
* logger.info("This is an INFO log with some context");
* };
*
* export const handler = middy(lambdaHandler).use(injectLambdaContext(logger));
* ```
*
* ### Object oriented usage with decorators
*
* If instead you use TypeScript classes to wrap your Lambda handler you can use the [@logger.injectLambdaContext()](./_aws_lambda_powertools_logger.Logger.html#injectLambdaContext) decorator.
*
* @example
* ```typescript
* import { Logger } from "@aws-lambda-powertools/logger";
* import { LambdaInterface } from '@aws-lambda-powertools/commons';
*
* const logger = new Logger();
*
* class Lambda implements LambdaInterface {
* // Decorate your handler class method
* @logger.injectLambdaContext()
* public async handler(_event: any, _context: any): Promise<void> {
* logger.info("This is an INFO log with some context");
* }
* }
*
* export const myFunction = new Lambda();
* export const handler = myFunction.handler;
* ```
*
* @class
* @implements {ClassThatLogs}
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/
*/
declare class Logger implements ClassThatLogs {

@@ -16,37 +102,250 @@ private static coldStart?;

private powertoolLogData;
/**
* It initializes the Logger class with an optional set of options (settings).
* *
* @param {LoggerOptions} options
*/
constructor(options?: LoggerOptions);
/**
* It adds the current Lambda function's invocation context data to the powertoolLogData property of the instance.
* This context data will be part of all printed log items.
*
* @param {Context} context
* @returns {void}
*/
addContext(context: Context): void;
/**
* It adds the given attributes (key-value pairs) to all log items generated by this Logger instance.
*
* @param {LogAttributes} attributes
* @returns {void}
*/
addPersistentLogAttributes(attributes?: LogAttributes): void;
/**
* Alias for addPersistentLogAttributes.
*
* @param {LogAttributes} attributes
* @returns {void}
*/
appendKeys(attributes?: LogAttributes): void;
/**
* It creates a separate Logger instance, identical to the current one
* It's possible to overwrite the new instance options by passing them.
*
* @param {LoggerOptions} options
* @returns {Logger}
*/
createChild(options?: LoggerOptions): Logger;
/**
* It prints a log item with level DEBUG.
*
* @param {LogItemMessage} input
* @param {Error | LogAttributes | unknown} extraInput
* @returns {void}
*/
debug(input: LogItemMessage, ...extraInput: LogItemExtraInput): void;
/**
* It prints a log item with level ERROR.
*
* @param {LogItemMessage} input
* @param {Error | LogAttributes | unknown} extraInput
* @returns {void}
*/
error(input: LogItemMessage, ...extraInput: LogItemExtraInput): void;
/**
* It evaluates whether the current Lambda function invocation has a cold start or not.
*
* @static
* @returns {void}
*/
static evaluateColdStartOnce(): void;
/**
* It returns a boolean value which is true if the current Lambda function cold start has been already evaluated, false otherwise.
*
* @static
* @returns {boolean}
*/
static getColdStartEvaluatedValue(): boolean;
/**
* It returns an optional boolean value, true if the current Lambda function invocation has a cold start, false otherwise.
*
* @static
* @returns {boolean | undefined}
*/
static getColdStartValue(): boolean | undefined;
/**
* It returns a boolean value, if true all the logs will be printed.
*
* @returns {boolean}
*/
getLogsSampled(): boolean;
/**
* It prints a log item with level INFO.
*
* @param {LogItemMessage} input
* @param {Error | LogAttributes | unknown} extraInput
* @returns {void}
*/
info(input: LogItemMessage, ...extraInput: LogItemExtraInput): void;
/**
* Method decorator that adds the current Lambda function context as extra
* information in all log items.
* The decorator can be used only when attached to a Lambda function handler which
* is written as method of a class, and should be declared just before the handler declaration.
*
* @see https://www.typescriptlang.org/docs/handbook/decorators.html#method-decorators
* @returns {HandlerMethodDecorator}
*/
injectLambdaContext(): HandlerMethodDecorator;
/**
* If the sample rate feature is enabled, the calculation that determines whether the logs
* will actually be printed or not for this invocation is done when the Logger class is
* initialized.
* This method will repeat that calculation (with possible different outcome).
*
* @returns {void}
*/
refreshSampleRateCalculation(): void;
/**
* It sets the value of a flag static propriety that tracks whether
* the cold start evaluation already took place.
*
* @param {boolean} value
* @static
* @returns {void}
*/
static setColdStartEvaluatedValue(value: boolean): void;
/**
* It sets the value of a flag static propriety that tracks whether
* the current Lambda invocation experienced a cold start.
*
* @static
* @param {boolean | undefined} value
* @returns {void}
*/
static setColdStartValue(value: boolean | undefined): void;
/**
* It sets the user-provided sample rate value.
*
* @param {number} [sampleRateValue]
* @returns {void}
*/
setSampleRateValue(sampleRateValue?: number): void;
/**
* It prints a log item with level WARN.
*
* @param {LogItemMessage} input
* @param {Error | LogAttributes | unknown} extraInput
* @returns {void}
*/
warn(input: LogItemMessage, ...extraInput: LogItemExtraInput): void;
/**
* It stores information that is printed in all log items.
*
* @param {Partial<PowertoolLogData>} attributesArray
* @private
* @returns {void}
*/
private addToPowertoolLogData;
/**
* It processes a particular log item so that it can be printed to stdout:
* - Merges ephemeral log attributes with persistent log attributes (printed for all logs) and additional info;
* - Formats all the log attributes;
*
* @private
* @param {LogLevel} logLevel
* @param {LogItemMessage} input
* @param {LogItemExtraInput} extraInput
* @returns {LogItem}
*/
private createAndPopulateLogItem;
/**
* It evaluates whether the current Lambda invocation experienced a
* cold start.
*
* @private
* @static
* @returns {void}
*/
private static evaluateColdStart;
/**
* It returns the custom config service, an abstraction used to fetch environment variables.
*
* @private
* @returns {ConfigServiceInterface | undefined}
*/
private getCustomConfigService;
/**
* It returns the instance of a service that fetches environment variables.
*
* @private
* @returns {EnvironmentVariablesService}
*/
private getEnvVarsService;
/**
* It returns the instance of a service that formats the structure of a
* log item's keys and values in the desired way.
*
* @private
* @returns {LogFormatterInterface}
*/
private getLogFormatter;
/**
* It returns the log level set for the Logger instance.
*
* @private
* @returns {LogLevel}
*/
private getLogLevel;
/**
* It returns the persistent log attributes, which are the attributes
* that will be logged in all log items.
*
* @private
* @returns {LogAttributes}
*/
private getPersistentLogAttributes;
/**
* It returns information that will be added in all log item by
* this Logger instance (different from user-provided persistent attributes).
*
* @private
* @returns {LogAttributes}
*/
private getPowertoolLogData;
/**
* It returns the numeric sample rate value.
*
* @private
* @returns {number}
*/
private getSampleRateValue;
/**
* It returns true if the provided log level is valid.
*
* @param {LogLevel} logLevel
* @private
* @returns {boolean}
*/
private isValidLogLevel;
/**
* It prints a given log with given log level.
*
* @param {LogLevel} logLevel
* @param {LogItem} log
* @private
*/
private printLog;
/**
* It prints a given log with given log level.
*
* @param {LogLevel} logLevel
* @param {LogItem} log
* @private
*/
private processLogItem;
/**
* When the data added in the log item when contains object references,
* JSON.stringify() doesn't try to solve them and throws an error: TypeError: cyclic object value.
* To mitigate this issue, this function will find and remove the cyclic references.
* When the data added in the log item contains object references,
* JSON.stringify() doesn't try to solve them and instead throws an error: TypeError: cyclic object value.
* To mitigate this issue, this method will find and remove all cyclic references.
*

@@ -57,11 +356,75 @@ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value

private removeCircularDependencies;
/**
* Sets the Logger's customer config service instance, which will be used
* to fetch environment variables.
*
* @private
* @param {ConfigServiceInterface} customConfigService
* @returns {void}
*/
private setCustomConfigService;
/**
* Sets the Logger's custom config service instance, which will be used
* to fetch environment variables.
*
* @private
* @param {ConfigServiceInterface} customConfigService
* @returns {void}
*/
private setEnvVarsService;
/**
* It sets the log formatter instance, in charge of giving a custom format
* to the structured logs
*
* @private
* @param {LogFormatterInterface} logFormatter
* @returns {void}
*/
private setLogFormatter;
/**
* It sets the Logger's instance log level.
*
* @private
* @param {LogLevel} logLevel
* @returns {void}
*/
private setLogLevel;
/**
* If the sample rate feature is enabled, it sets a property that tracks whether this Lambda function invocation
* will print logs or not.
*
* @private
* @returns {void}
*/
private setLogsSampled;
/**
* It configures the Logger instance settings that will affect the Logger's behaviour
* and the content of all logs.
*
* @private
* @param {LoggerOptions} options
* @returns {Logger}
*/
private setOptions;
/**
* It adds important data to the Logger instance that will affect the content of all logs.
*
* @param {string} serviceName
* @param {Environment} environment
* @param {LogAttributes} persistentLogAttributes
* @private
* @returns {void}
*/
private setPowertoolLogData;
/**
* It checks whether the current log item should/can be printed.
*
* @param {string} serviceName
* @param {Environment} environment
* @param {LogAttributes} persistentLogAttributes
* @private
* @returns {boolean}
*/
private shouldPrint;
}
export { Logger };

@@ -12,3 +12,94 @@ "use strict";

const config_1 = require("./config");
/**
* ## Intro
* The Logger utility provides an opinionated logger with output structured as JSON.
*
* ## Key features
* * Capture key fields from Lambda context, cold start and structures logging output as JSON
* * Log Lambda context when instructed (disabled by default)
* * Log sampling prints all logs for a percentage of invocations (disabled by default)
* * Append additional keys to structured log at any point in time
*
* ## Usage
*
* For more usage examples, see [our documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/).
*
* ### Basic usage
*
* @example
* ```typescript
* import { Logger } from "@aws-lambda-powertools/logger";
*
* // Logger parameters fetched from the environment variables:
* const logger = new Logger();
* ```
*
* ### Functions usage with manual instrumentation
*
* If you prefer to manually instrument your Lambda handler you can use the methods in the Logger class directly.
*
* @example
* ```typescript
* import { Logger } from "@aws-lambda-powertools/logger";
*
* const logger = new Logger();
*
* export const handler = async (_event, context) => {
* logger.addContext(context);
* logger.info("This is an INFO log with some context");
* };
* ```
*
* ### Functions usage with middleware
*
* If you use function-based Lambda handlers you can use the [injectLambdaContext()](#injectLambdaContext)
* middy middleware to automatically add context to your Lambda logs.
*
* @example
* ```typescript
* import { Logger, injectLambdaContext } from "@aws-lambda-powertools/logger";
* import middy from '@middy/core';
*
* const logger = new Logger();
*
* const lambdaHandler = async (_event: any, _context: any) => {
* logger.info("This is an INFO log with some context");
* };
*
* export const handler = middy(lambdaHandler).use(injectLambdaContext(logger));
* ```
*
* ### Object oriented usage with decorators
*
* If instead you use TypeScript classes to wrap your Lambda handler you can use the [@logger.injectLambdaContext()](./_aws_lambda_powertools_logger.Logger.html#injectLambdaContext) decorator.
*
* @example
* ```typescript
* import { Logger } from "@aws-lambda-powertools/logger";
* import { LambdaInterface } from '@aws-lambda-powertools/commons';
*
* const logger = new Logger();
*
* class Lambda implements LambdaInterface {
* // Decorate your handler class method
* @logger.injectLambdaContext()
* public async handler(_event: any, _context: any): Promise<void> {
* logger.info("This is an INFO log with some context");
* }
* }
*
* export const myFunction = new Lambda();
* export const handler = myFunction.handler;
* ```
*
* @class
* @implements {ClassThatLogs}
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/
*/
class Logger {
/**
* It initializes the Logger class with an optional set of options (settings).
* *
* @param {LoggerOptions} options
*/
constructor(options = {}) {

@@ -26,2 +117,9 @@ this.logLevelThresholds = {

}
/**
* It adds the current Lambda function's invocation context data to the powertoolLogData property of the instance.
* This context data will be part of all printed log items.
*
* @param {Context} context
* @returns {void}
*/
addContext(context) {

@@ -41,17 +139,56 @@ Logger.evaluateColdStartOnce();

}
/**
* It adds the given attributes (key-value pairs) to all log items generated by this Logger instance.
*
* @param {LogAttributes} attributes
* @returns {void}
*/
addPersistentLogAttributes(attributes) {
this.persistentLogAttributes = (0, lodash_merge_1.default)(attributes, this.getPersistentLogAttributes());
}
/**
* Alias for addPersistentLogAttributes.
*
* @param {LogAttributes} attributes
* @returns {void}
*/
appendKeys(attributes) {
this.addPersistentLogAttributes(attributes);
}
/**
* It creates a separate Logger instance, identical to the current one
* It's possible to overwrite the new instance options by passing them.
*
* @param {LoggerOptions} options
* @returns {Logger}
*/
createChild(options = {}) {
return (0, lodash_clonedeep_1.default)(this).setOptions(options);
}
/**
* It prints a log item with level DEBUG.
*
* @param {LogItemMessage} input
* @param {Error | LogAttributes | unknown} extraInput
* @returns {void}
*/
debug(input, ...extraInput) {
this.processLogItem('DEBUG', input, extraInput);
}
/**
* It prints a log item with level ERROR.
*
* @param {LogItemMessage} input
* @param {Error | LogAttributes | unknown} extraInput
* @returns {void}
*/
error(input, ...extraInput) {
this.processLogItem('ERROR', input, extraInput);
}
/**
* It evaluates whether the current Lambda function invocation has a cold start or not.
*
* @static
* @returns {void}
*/
static evaluateColdStartOnce() {

@@ -62,14 +199,47 @@ if (!Logger.getColdStartEvaluatedValue()) {

}
/**
* It returns a boolean value which is true if the current Lambda function cold start has been already evaluated, false otherwise.
*
* @static
* @returns {boolean}
*/
static getColdStartEvaluatedValue() {
return Logger.coldStartEvaluated;
}
/**
* It returns an optional boolean value, true if the current Lambda function invocation has a cold start, false otherwise.
*
* @static
* @returns {boolean | undefined}
*/
static getColdStartValue() {
return Logger.coldStart;
}
/**
* It returns a boolean value, if true all the logs will be printed.
*
* @returns {boolean}
*/
getLogsSampled() {
return this.logsSampled;
}
/**
* It prints a log item with level INFO.
*
* @param {LogItemMessage} input
* @param {Error | LogAttributes | unknown} extraInput
* @returns {void}
*/
info(input, ...extraInput) {
this.processLogItem('INFO', input, extraInput);
}
/**
* Method decorator that adds the current Lambda function context as extra
* information in all log items.
* The decorator can be used only when attached to a Lambda function handler which
* is written as method of a class, and should be declared just before the handler declaration.
*
* @see https://www.typescriptlang.org/docs/handbook/decorators.html#method-decorators
* @returns {HandlerMethodDecorator}
*/
injectLambdaContext() {

@@ -84,11 +254,41 @@ return (target, propertyKey, descriptor) => {

}
/**
* If the sample rate feature is enabled, the calculation that determines whether the logs
* will actually be printed or not for this invocation is done when the Logger class is
* initialized.
* This method will repeat that calculation (with possible different outcome).
*
* @returns {void}
*/
refreshSampleRateCalculation() {
this.setLogsSampled();
}
/**
* It sets the value of a flag static propriety that tracks whether
* the cold start evaluation already took place.
*
* @param {boolean} value
* @static
* @returns {void}
*/
static setColdStartEvaluatedValue(value) {
Logger.coldStartEvaluated = value;
}
/**
* It sets the value of a flag static propriety that tracks whether
* the current Lambda invocation experienced a cold start.
*
* @static
* @param {boolean | undefined} value
* @returns {void}
*/
static setColdStartValue(value) {
Logger.coldStart = value;
}
/**
* It sets the user-provided sample rate value.
*
* @param {number} [sampleRateValue]
* @returns {void}
*/
setSampleRateValue(sampleRateValue) {

@@ -100,5 +300,19 @@ this.powertoolLogData.sampleRateValue =

}
/**
* It prints a log item with level WARN.
*
* @param {LogItemMessage} input
* @param {Error | LogAttributes | unknown} extraInput
* @returns {void}
*/
warn(input, ...extraInput) {
this.processLogItem('WARN', input, extraInput);
}
/**
* It stores information that is printed in all log items.
*
* @param {Partial<PowertoolLogData>} attributesArray
* @private
* @returns {void}
*/
addToPowertoolLogData(...attributesArray) {

@@ -109,3 +323,15 @@ attributesArray.forEach((attributes) => {

}
/**
* It processes a particular log item so that it can be printed to stdout:
* - Merges ephemeral log attributes with persistent log attributes (printed for all logs) and additional info;
* - Formats all the log attributes;
*
* @private
* @param {LogLevel} logLevel
* @param {LogItemMessage} input
* @param {LogItemExtraInput} extraInput
* @returns {LogItem}
*/
createAndPopulateLogItem(logLevel, input, extraInput) {
// TODO: this method's logic is hard to understand, there is an opportunity here to simplify this logic.
const unformattedBaseAttributes = (0, lodash_merge_1.default)({

@@ -130,2 +356,10 @@ logLevel,

}
/**
* It evaluates whether the current Lambda invocation experienced a
* cold start.
*
* @private
* @static
* @returns {void}
*/
static evaluateColdStart() {

@@ -144,20 +378,65 @@ const coldStartValue = Logger.getColdStartValue();

}
/**
* It returns the custom config service, an abstraction used to fetch environment variables.
*
* @private
* @returns {ConfigServiceInterface | undefined}
*/
getCustomConfigService() {
return this.customConfigService;
}
/**
* It returns the instance of a service that fetches environment variables.
*
* @private
* @returns {EnvironmentVariablesService}
*/
getEnvVarsService() {
return this.envVarsService;
}
/**
* It returns the instance of a service that formats the structure of a
* log item's keys and values in the desired way.
*
* @private
* @returns {LogFormatterInterface}
*/
getLogFormatter() {
return this.logFormatter;
}
/**
* It returns the log level set for the Logger instance.
*
* @private
* @returns {LogLevel}
*/
getLogLevel() {
return this.logLevel;
}
/**
* It returns the persistent log attributes, which are the attributes
* that will be logged in all log items.
*
* @private
* @returns {LogAttributes}
*/
getPersistentLogAttributes() {
return this.persistentLogAttributes;
}
/**
* It returns information that will be added in all log item by
* this Logger instance (different from user-provided persistent attributes).
*
* @private
* @returns {LogAttributes}
*/
getPowertoolLogData() {
return this.powertoolLogData;
}
/**
* It returns the numeric sample rate value.
*
* @private
* @returns {number}
*/
getSampleRateValue() {

@@ -169,5 +448,19 @@ if (!this.powertoolLogData?.sampleRateValue) {

}
/**
* It returns true if the provided log level is valid.
*
* @param {LogLevel} logLevel
* @private
* @returns {boolean}
*/
isValidLogLevel(logLevel) {
return typeof logLevel === 'string' && logLevel.toUpperCase() in this.logLevelThresholds;
}
/**
* It prints a given log with given log level.
*
* @param {LogLevel} logLevel
* @param {LogItem} log
* @private
*/
printLog(logLevel, log) {

@@ -178,2 +471,9 @@ log.prepareForPrint();

}
/**
* It prints a given log with given log level.
*
* @param {LogLevel} logLevel
* @param {LogItem} log
* @private
*/
processLogItem(logLevel, input, extraInput) {

@@ -186,5 +486,5 @@ if (!this.shouldPrint(logLevel)) {

/**
* When the data added in the log item when contains object references,
* JSON.stringify() doesn't try to solve them and throws an error: TypeError: cyclic object value.
* To mitigate this issue, this function will find and remove the cyclic references.
* When the data added in the log item contains object references,
* JSON.stringify() doesn't try to solve them and instead throws an error: TypeError: cyclic object value.
* To mitigate this issue, this method will find and remove all cyclic references.
*

@@ -210,11 +510,42 @@ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value

}
/**
* Sets the Logger's customer config service instance, which will be used
* to fetch environment variables.
*
* @private
* @param {ConfigServiceInterface} customConfigService
* @returns {void}
*/
setCustomConfigService(customConfigService) {
this.customConfigService = customConfigService ? customConfigService : undefined;
}
/**
* Sets the Logger's custom config service instance, which will be used
* to fetch environment variables.
*
* @private
* @param {ConfigServiceInterface} customConfigService
* @returns {void}
*/
setEnvVarsService() {
this.envVarsService = new config_1.EnvironmentVariablesService();
}
/**
* It sets the log formatter instance, in charge of giving a custom format
* to the structured logs
*
* @private
* @param {LogFormatterInterface} logFormatter
* @returns {void}
*/
setLogFormatter(logFormatter) {
this.logFormatter = logFormatter || new formatter_1.PowertoolLogFormatter();
}
/**
* It sets the Logger's instance log level.
*
* @private
* @param {LogLevel} logLevel
* @returns {void}
*/
setLogLevel(logLevel) {

@@ -237,2 +568,9 @@ if (this.isValidLogLevel(logLevel)) {

}
/**
* If the sample rate feature is enabled, it sets a property that tracks whether this Lambda function invocation
* will print logs or not.
*
* @private
* @returns {void}
*/
setLogsSampled() {

@@ -243,2 +581,10 @@ const sampleRateValue = this.getSampleRateValue();

}
/**
* It configures the Logger instance settings that will affect the Logger's behaviour
* and the content of all logs.
*
* @private
* @param {LoggerOptions} options
* @returns {Logger}
*/
setOptions(options) {

@@ -256,2 +602,11 @@ const { logLevel, serviceName, sampleRateValue, logFormatter, customConfigService, persistentLogAttributes, environment, } = options;

}
/**
* It adds important data to the Logger instance that will affect the content of all logs.
*
* @param {string} serviceName
* @param {Environment} environment
* @param {LogAttributes} persistentLogAttributes
* @private
* @returns {void}
*/
setPowertoolLogData(serviceName, environment, persistentLogAttributes = {}) {

@@ -268,2 +623,11 @@ this.addToPowertoolLogData({

}
/**
* It checks whether the current log item should/can be printed.
*
* @param {string} serviceName
* @param {Environment} environment
* @param {LogAttributes} persistentLogAttributes
* @private
* @returns {boolean}
*/
shouldPrint(logLevel) {

@@ -281,2 +645,2 @@ if (this.logLevelThresholds[logLevel] >= this.logLevelThresholds[this.getLogLevel()]) {

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FdBQVcsSUFBSSxJQUFJLENBQUMsc0JBQXNCLEVBQUUsRUFBRSxjQUFjLEVBQUUsSUFBSSxJQUFJLENBQUMsaUJBQWlCLEVBQUUsQ0FBQyxjQUFjLEVBQUUsSUFBSSxNQUFNLENBQUMsa0JBQWtCO1lBQzFJLFdBQVcsRUFBRSxJQUFJLENBQUMsaUJBQWlCLEVBQUUsQ0FBQyxjQUFjLEVBQUU7U0FDdkQsRUFDRCx1QkFBdUIsQ0FDeEIsQ0FBQztJQUNKLENBQUM7SUFFRDs7Ozs7Ozs7T0FRRztJQUNLLFdBQVcsQ0FBQyxRQUFrQjtRQUNwQyxJQUFJLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxRQUFRLENBQUMsSUFBSSxJQUFJLENBQUMsa0JBQWtCLENBQUMsSUFBSSxDQUFDLFdBQVcsRUFBRSxDQUFDLEVBQUU7WUFDcEYsT0FBTyxJQUFJLENBQUM7U0FDYjtRQUVELE9BQU8sSUFBSSxDQUFDLGNBQWMsRUFBRSxDQUFDO0lBQy9CLENBQUM7O0FBR00sd0JBQU07QUEzbUJFLGdCQUFTLEdBQWEsU0FBUyxDQUFDO0FBRWhDLHlCQUFrQixHQUFZLEtBQUssQ0FBQztBQUkzQixzQkFBZSxHQUFhLE1BQU0sQ0FBQztBQUVuQyx5QkFBa0IsR0FBVyxtQkFBbUIsQ0FBQyJ9
import type { Logger } from '../Logger';
import middy from '@middy/core';
/**
* A middy middleware that adds the current Lambda invocation's context inside all log items.
*
* ## Usage
*
* @example
* ```typescript
* import { Logger, injectLambdaContext } from "@aws-lambda-powertools/logger";
*
* import middy from '@middy/core';
*
*
* const logger = new Logger();
*
* const lambdaHandler = async (_event: any, _context: any) => {
* logger.info("This is an INFO log with some context");
* };
*
*
* export const handler = middy(lambdaHandler).use(injectLambdaContext(logger));
* ```
*
* @param {Logger|Logger[]} target - The Tracer instance to use for tracing
* @returns {middy.MiddlewareObj} - The middy middleware object
*/
declare const injectLambdaContext: (target: Logger | Logger[]) => middy.MiddlewareObj;
export { injectLambdaContext, };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.injectLambdaContext = void 0;
/**
* A middy middleware that adds the current Lambda invocation's context inside all log items.
*
* ## Usage
*
* @example
* ```typescript
* import { Logger, injectLambdaContext } from "@aws-lambda-powertools/logger";
*
* import middy from '@middy/core';
*
*
* const logger = new Logger();
*
* const lambdaHandler = async (_event: any, _context: any) => {
* logger.info("This is an INFO log with some context");
* };
*
*
* export const handler = middy(lambdaHandler).use(injectLambdaContext(logger));
* ```
*
* @param {Logger|Logger[]} target - The Tracer instance to use for tracing
* @returns {middy.MiddlewareObj} - The middy middleware object
*/
const injectLambdaContext = (target) => {

@@ -16,2 +41,2 @@ const injectLambdaContextBefore = async (request) => {

exports.injectLambdaContext = injectLambdaContext;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlkZHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbWlkZGxld2FyZS9taWRkeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQSxNQUFNLG1CQUFtQixHQUFHLENBQUMsTUFBeUIsRUFBdUIsRUFBRTtJQUM3RSxNQUFNLHlCQUF5QixHQUFHLEtBQUssRUFBRSxPQUFzQixFQUFpQixFQUFFO1FBQ2hGLE1BQU0sT0FBTyxHQUFHLE1BQU0sWUFBWSxLQUFLLENBQUMsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUM1RCxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUMsTUFBYyxFQUFFLEVBQUU7WUFDakMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDckMsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDLENBQUM7SUFFRixPQUFPO1FBQ0wsTUFBTSxFQUFFLHlCQUF5QjtLQUNsQyxDQUFDO0FBQ0osQ0FBQyxDQUFDO0FBR0Esa0RBQW1CIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlkZHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbWlkZGxld2FyZS9taWRkeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFHQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBd0JHO0FBQ0gsTUFBTSxtQkFBbUIsR0FBRyxDQUFDLE1BQXlCLEVBQXVCLEVBQUU7SUFDN0UsTUFBTSx5QkFBeUIsR0FBRyxLQUFLLEVBQUUsT0FBc0IsRUFBaUIsRUFBRTtRQUNoRixNQUFNLE9BQU8sR0FBRyxNQUFNLFlBQVksS0FBSyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUM7UUFDNUQsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDLE1BQWMsRUFBRSxFQUFFO1lBQ2pDLE1BQU0sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ3JDLENBQUMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQyxDQUFDO0lBRUYsT0FBTztRQUNMLE1BQU0sRUFBRSx5QkFBeUI7S0FDbEMsQ0FBQztBQUNKLENBQUMsQ0FBQztBQUdBLGtEQUFtQiJ9

4

package.json
{
"name": "@aws-lambda-powertools/logger",
"version": "0.3.3",
"version": "0.4.0",
"description": "The logging package for the AWS Lambda powertools (TypeScript) library",

@@ -81,3 +81,3 @@ "author": {

},
"gitHead": "74310456754ce9ce92afba9b80082ffed606f14e"
"gitHead": "1b8d963974e9ccc5994148a44410a6e0cfe3f4ba"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc