aws-lambda-log-wrapper
TypeScript icon, indicating that this package has built-in type declarations

1.1.8 • Public • Published

aws-lambda-log-wrapper

npm version

A tiny little wrapper around the amazing Lambda Log library for use as logging middleware in AWS SDK for JavaScript v3.

Installation

yarn add aws-lambda-log-wrapper

OR

npm i aws-lambda-log-wrapper

Usage

import { AwsLambdaLogWrapper } from 'aws-lambda-log-wrapper';
import { STSClient, GetCallerIdentityCommand } from '@aws-sdk/client-sts';
import { LambdaLog } from 'lambda-log';

const log = new LambdaLog();

new STSClient({ logger: new AwsLambdaLogWrapper(log) }).send(new GetCallerIdentityCommand({}))

Writes the following to the console:

{
  "_logLevel": "info",
  "msg": "AWS: Call STSClient.GetCallerIdentityCommand",
  "clientName":"STSClient",
  "commandName":"GetCallerIdentityCommand",
  "input": {},
  "output": {
    "UserId": "...",
    "Account": "...",
    "Arn": "arn:aws:sts::...:assumed-role/..."
  },
  "metadata": {
    "httpStatusCode": 200,
    "requestId": "25fe0f95-7975-443f-bcd9-65321461aa43",
    "attempts": 1,
    "totalRetryDelay": 0
  },
  "aws-sdk": true,
  "_tags": []
}

Readme

Keywords

none

Package Sidebar

Install

npm i aws-lambda-log-wrapper

Weekly Downloads

0

Version

1.1.8

License

MIT

Unpacked Size

8.14 kB

Total Files

15

Last publish

Collaborators

  • taschmidt