New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More β†’
Socket
Sign inDemoInstall
Socket

@aws-lambda-powertools/logger

Package Overview
Dependencies
Maintainers
2
Versions
100
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 1.9.0 to 1.10.0

2

lib/config/ConfigServiceInterface.d.ts

@@ -6,3 +6,3 @@ /**

* @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
* @see https://docs.powertools.aws.dev/lambda-typescript/latest/#environment-variables
*/

@@ -9,0 +9,0 @@ interface ConfigServiceInterface {

@@ -15,3 +15,3 @@ import { ConfigServiceInterface } from './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
* @see https://docs.powertools.aws.dev/lambda-typescript/latest/#environment-variables
*/

@@ -18,0 +18,0 @@ declare class EnvironmentVariablesService extends CommonEnvironmentVariablesService implements ConfigServiceInterface {

@@ -17,3 +17,3 @@ "use strict";

* @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
* @see https://docs.powertools.aws.dev/lambda-typescript/latest/#environment-variables
*/

@@ -20,0 +20,0 @@ class EnvironmentVariablesService extends commons_1.EnvironmentVariablesService {

@@ -16,3 +16,3 @@ import type { Context } from 'aws-lambda';

*
* For more usage examples, see [our documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/).
* For more usage examples, see [our documentation](https://docs.powertools.aws.dev/lambda-typescript/latest/core/logger/).
*

@@ -92,3 +92,3 @@ * ### Basic usage

* @implements {ClassThatLogs}
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/
* @see https://docs.powertools.aws.dev/lambda-typescript/latest/core/logger/
*/

@@ -95,0 +95,0 @@ declare class Logger extends Utility implements ClassThatLogs {

@@ -26,3 +26,3 @@ "use strict";

*
* For more usage examples, see [our documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/).
* For more usage examples, see [our documentation](https://docs.powertools.aws.dev/lambda-typescript/latest/core/logger/).
*

@@ -102,3 +102,3 @@ * ### Basic usage

* @implements {ClassThatLogs}
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/
* @see https://docs.powertools.aws.dev/lambda-typescript/latest/core/logger/
*/

@@ -105,0 +105,0 @@ class Logger extends commons_1.Utility {

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

const Logger_1 = require("../Logger");
const middleware_1 = require("@aws-lambda-powertools/commons/lib/middleware");
/**

@@ -33,8 +34,21 @@ * A middy middleware that helps emitting CloudWatch EMF metrics in your logs.

const persistentAttributes = [];
const isClearState = options && options.clearState === true;
/**
* Set the cleanup function to be called in case other middlewares return early.
*
* @param request - The request object
*/
const setCleanupFunction = (request) => {
request.internal = {
...request.internal,
[middleware_1.LOGGER_KEY]: injectLambdaContextAfterOrOnError,
};
};
const injectLambdaContextBefore = async (request) => {
loggers.forEach((logger, index) => {
if (options && options.clearState === true) {
if (isClearState) {
persistentAttributes[index] = {
...logger.getPersistentLogAttributes(),
};
setCleanupFunction(request);
}

@@ -45,3 +59,3 @@ Logger_1.Logger.injectLambdaContextBefore(logger, request.event, request.context, options);

const injectLambdaContextAfterOrOnError = async () => {
if (options && options.clearState === true) {
if (isClearState) {
loggers.forEach((logger, index) => {

@@ -59,2 +73,2 @@ Logger_1.Logger.injectLambdaContextAfterOrOnError(logger, persistentAttributes[index], options);

exports.injectLambdaContext = injectLambdaContext;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlkZHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zc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rREFBbUIifQ==
{
"name": "@aws-lambda-powertools/logger",
"version": "1.9.0",
"version": "1.10.0",
"description": "The logging package for the Powertools for AWS Lambda (TypeScript) library",

@@ -9,47 +9,11 @@ "author": {

},
"publishConfig": {
"access": "public"
},
"scripts": {
"commit": "commit",
"test": "npm run test:unit",
"test:unit": "jest --group=unit --detectOpenHandles --coverage --verbose",
"test:e2e:nodejs14x": "RUNTIME=nodejs14x jest --group=e2e",
"test:e2e:nodejs16x": "RUNTIME=nodejs16x jest --group=e2e",
"test:e2e:nodejs18x": "RUNTIME=nodejs18x jest --group=e2e",
"test:e2e": "jest --group=e2e",
"watch": "jest --watch --group=unit",
"build": "tsc",
"lint": "eslint --ext .ts,.js --no-error-on-unmatched-pattern .",
"lint-fix": "eslint --fix --ext .ts,.js --no-error-on-unmatched-pattern .",
"package": "mkdir -p dist/ && npm pack && mv *.tgz dist/",
"package-bundle": "../../package-bundler.sh logger-bundle ./dist",
"prepare": "npm run build"
},
"lint-staged": {
"*.ts": "npm run lint-fix",
"*.js": "npm run lint-fix"
},
"homepage": "https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/logging#readme",
"license": "MIT",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"typedocMain": "src/index.ts",
"devDependencies": {
"@types/lodash.merge": "^4.6.7"
},
"files": [
"lib"
],
"license": "MIT-0",
"homepage": "https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/packages/logger#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/awslabs/aws-lambda-powertools-typescript.git"
"url": "git+https://github.com/aws-powertools/powertools-lambda-typescript.git"
},
"bugs": {
"url": "https://github.com/awslabs/aws-lambda-powertools-typescript/issues"
"url": "https://github.com/aws-powertools/powertools-lambda-typescript/issues"
},
"dependencies": {
"@aws-lambda-powertools/commons": "^1.9.0",
"lodash.merge": "^4.6.2"
},
"keywords": [

@@ -64,3 +28,11 @@ "aws",

],
"gitHead": "8d62a62452bfc1b6f1621144e8b3d011b5a189fc"
}
"dependencies": {
"@aws-lambda-powertools/commons": "^1.10.0",
"lodash.merge": "^4.6.2"
},
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"files": [
"lib"
]
}
# Powertools for AWS Lambda (TypeScript) <!-- omit in toc -->
Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/#features).
Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.powertools.aws.dev/lambda-typescript/latest/#features).
You can use the library in both TypeScript and JavaScript code bases.
> Also available in [Python](https://github.com/awslabs/aws-lambda-powertools-python), [Java](https://github.com/awslabs/aws-lambda-powertools-java), and [.NET](https://awslabs.github.io/aws-lambda-powertools-dotnet/).
> Also available in [Python](https://github.com/aws-powertools/powertools-lambda-python), [Java](https://github.com/aws-powertools/powertools-lambda-java), and [.NET](https://docs.powertools.aws.dev/lambda-dotnet/).
**[Documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/)** | **[npm](https://www.npmjs.com/org/aws-lambda-powertools)** | **[Roadmap](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/roadmap)** | **[Examples](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples)** | **[Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo)**
**[Documentation](https://docs.powertools.aws.dev/lambda-typescript/)** | **[npm](https://www.npmjs.com/org/aws-lambda-powertools)** | **[Roadmap](https://docs.powertools.aws.dev/lambda-typescript/latest/roadmap)** | **[Examples](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples)** | **[Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo)**

@@ -30,10 +30,10 @@ ## Table of contents <!-- omit in toc -->

* **[Tracer](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/tracer/)** - Utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
* **[Logger](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/)** - Structured logging made easier, and a middleware to enrich log items with key details of the Lambda context
* **[Metrics](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/metrics/)** - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
* **[Parameters (beta)](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/utilities/parameters/)** - High-level functions to retrieve one or more parameters from AWS SSM, Secrets Manager, AppConfig, and DynamoDB
* **[Tracer](https://docs.powertools.aws.dev/lambda-typescript/latest/core/tracer/)** - Utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
* **[Logger](https://docs.powertools.aws.dev/lambda-typescript/latest/core/logger/)** - Structured logging made easier, and a middleware to enrich log items with key details of the Lambda context
* **[Metrics](https://docs.powertools.aws.dev/lambda-typescript/latest/core/metrics/)** - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
* **[Parameters (beta)](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/)** - High-level functions to retrieve one or more parameters from AWS SSM, Secrets Manager, AppConfig, and DynamoDB
## Getting started
Find the complete project's [documentation here](https://awslabs.github.io/aws-lambda-powertools-typescript).
Find the complete project's [documentation here](https://docs.powertools.aws.dev/lambda-typescript).

@@ -54,14 +54,14 @@ ### Installation

πŸ‘‰ [Installation guide for the **Tracer** utility](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/tracer#getting-started)
πŸ‘‰ [Installation guide for the **Tracer** utility](https://docs.powertools.aws.dev/lambda-typescript/latest/core/tracer#getting-started)
πŸ‘‰ [Installation guide for the **Logger** utility](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger#getting-started)
πŸ‘‰ [Installation guide for the **Logger** utility](https://docs.powertools.aws.dev/lambda-typescript/latest/core/logger#getting-started)
πŸ‘‰ [Installation guide for the **Metrics** utility](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/metrics#getting-started)
πŸ‘‰ [Installation guide for the **Metrics** utility](https://docs.powertools.aws.dev/lambda-typescript/latest/core/metrics#getting-started)
πŸ‘‰ [Installation guide for the **Parameters** utility](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/utilities/parameters/#getting-started)
πŸ‘‰ [Installation guide for the **Parameters** utility](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#getting-started)
### Examples
* [CDK](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples/cdk)
* [SAM](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples/sam)
* [CDK](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples/cdk)
* [SAM](https://github.com/aws-powertools/powertools-lambda-typescript/tree/main/examples/sam)

@@ -75,3 +75,3 @@ ### Serverless TypeScript Demo application

If you are interested in contributing to this project, please refer to our [Contributing Guidelines](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/CONTRIBUTING.md).
If you are interested in contributing to this project, please refer to our [Contributing Guidelines](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/CONTRIBUTING.md).

@@ -81,3 +81,3 @@ ## Roadmap

The roadmap of Powertools for AWS Lambda (TypeScript) is driven by customers’ demand.
Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/aws-powertools/powertools-lambda-typescript/issues), or [creating new ones](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose), in this GitHub repository.

@@ -93,3 +93,3 @@ ## Connect

Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (TypeScript), you can request to have your name and logo added to the README file by raising a [Support Lambda Powertools for AWS Lambda (TypeScript) (become a reference)](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E) issue.
Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (TypeScript), you can request to have your name and logo added to the README file by raising a [Support Lambda Powertools for AWS Lambda (TypeScript) (become a reference)](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E) issue.

@@ -108,3 +108,3 @@ The following companies, among others, use Powertools:

Share what you did with Powertools for AWS Lambda (TypeScript) πŸ’žπŸ’ž. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (TypeScript) [here](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/we_made_this).
Share what you did with Powertools for AWS Lambda (TypeScript) πŸ’žπŸ’ž. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (TypeScript) [here](https://docs.powertools.aws.dev/lambda-typescript/latest/we_made_this).

@@ -111,0 +111,0 @@ ### Using Lambda Layer

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