@logtail/core
Advanced tools
Comparing version 0.1.10 to 0.1.12
@@ -112,4 +112,11 @@ "use strict"; | ||
} | ||
// Pass the log through the middleware pipeline | ||
const transformedLog = await this._middleware.reduceRight((fn, pipedLog) => fn.then(pipedLog), Promise.resolve(log)); | ||
let transformedLog = log; | ||
for (const middleware of this._middleware) { | ||
let newTransformedLog = await middleware(transformedLog); | ||
if (newTransformedLog == null) { | ||
// Don't push the log if it was filtered out in a middleware | ||
return transformedLog; | ||
} | ||
transformedLog = newTransformedLog; | ||
} | ||
try { | ||
@@ -116,0 +123,0 @@ // Push the log through the batcher, and sync |
@@ -110,4 +110,11 @@ import { LogLevel } from "@logtail/types"; | ||
} | ||
// Pass the log through the middleware pipeline | ||
const transformedLog = await this._middleware.reduceRight((fn, pipedLog) => fn.then(pipedLog), Promise.resolve(log)); | ||
let transformedLog = log; | ||
for (const middleware of this._middleware) { | ||
let newTransformedLog = await middleware(transformedLog); | ||
if (newTransformedLog == null) { | ||
// Don't push the log if it was filtered out in a middleware | ||
return transformedLog; | ||
} | ||
transformedLog = newTransformedLog; | ||
} | ||
try { | ||
@@ -114,0 +121,0 @@ // Push the log through the batcher, and sync |
{ | ||
"name": "@logtail/core", | ||
"version": "0.1.10", | ||
"version": "0.1.12", | ||
"description": "Logtail.com - logging core", | ||
@@ -43,6 +43,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@logtail/tools": "^0.1.8", | ||
"@logtail/types": "^0.1.8" | ||
"@logtail/tools": "^0.1.12", | ||
"@logtail/types": "^0.1.12" | ||
}, | ||
"gitHead": "6f31cf610eea1d13dbc8d4b32c12418da414416b" | ||
"gitHead": "e2bab3d1f3ba3c02951b21de5391b0db63521f54" | ||
} |
@@ -183,7 +183,11 @@ import { | ||
// Pass the log through the middleware pipeline | ||
const transformedLog = await this._middleware.reduceRight( | ||
(fn, pipedLog) => fn.then(pipedLog), | ||
Promise.resolve(log as ILogtailLog) | ||
); | ||
let transformedLog = log as ILogtailLog | null; | ||
for (const middleware of this._middleware) { | ||
let newTransformedLog = await middleware(transformedLog as ILogtailLog); | ||
if (newTransformedLog == null) { | ||
// Don't push the log if it was filtered out in a middleware | ||
return transformedLog as ILogtailLog & TContext; | ||
} | ||
transformedLog = newTransformedLog; | ||
} | ||
@@ -190,0 +194,0 @@ try { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79450
1491
1
Updated@logtail/tools@^0.1.12
Updated@logtail/types@^0.1.12