aws-embedded-metrics
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -11,4 +11,6 @@ import { MetricsContext } from '../logger/MetricsContext'; | ||
private serializer; | ||
readonly console: Console; | ||
private static readonly AWS_LAMBDA_LOG_FORMAT; | ||
constructor(serializer?: ISerializer); | ||
accept(context: MetricsContext): Promise<void>; | ||
} |
@@ -17,2 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const console_1 = require("console"); | ||
const LogSerializer_1 = require("../serializers/LogSerializer"); | ||
@@ -27,2 +28,5 @@ /** | ||
this.serializer = serializer || new LogSerializer_1.LogSerializer(); | ||
// To avoid escaping EMF when using Lambda JSON log format we need to use Console() instead of console | ||
this.console = | ||
process.env[ConsoleSink.AWS_LAMBDA_LOG_FORMAT] === 'JSON' ? new console_1.Console(process.stdout, process.stderr) : console; | ||
} | ||
@@ -32,3 +36,3 @@ accept(context) { | ||
const events = this.serializer.serialize(context); | ||
events.forEach(event => console.log(event)); | ||
events.forEach((event) => this.console.log(event)); | ||
return Promise.resolve(); | ||
@@ -38,1 +42,2 @@ } | ||
exports.ConsoleSink = ConsoleSink; | ||
ConsoleSink.AWS_LAMBDA_LOG_FORMAT = 'AWS_LAMBDA_LOG_FORMAT'; |
{ | ||
"name": "aws-embedded-metrics", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "AWS Embedded Metrics Client Library", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -34,2 +34,5 @@ # aws-embedded-metrics | ||
> **Important** | ||
> Versions 4.1.1+, 3.0.2+, 2.0.7+ are required for usage in Lambda with JSON log format. Using previous versions in such Lambda environments will lead to metric loss. | ||
## Usage | ||
@@ -36,0 +39,0 @@ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
121246
2346
410
17