@logtail/core
Advanced tools
Comparing version 0.4.14 to 0.4.15
@@ -24,3 +24,2 @@ import { ILogLevel, ILogtailLog, ILogtailOptions, Context, Middleware, Sync } from "@logtail/types"; | ||
constructor(sourceToken: string, options?: Partial<ILogtailOptions>); | ||
private getContextFromError; | ||
/** | ||
@@ -27,0 +26,0 @@ * Flush batched logs to Logtail |
@@ -5,2 +5,3 @@ "use strict"; | ||
const tools_1 = require("@logtail/tools"); | ||
const serialize_error_1 = require("serialize-error"); | ||
// Set default options for Logtail | ||
@@ -84,8 +85,2 @@ const defaultOptions = { | ||
} | ||
/* PRIVATE METHODS */ | ||
getContextFromError(e) { | ||
return { | ||
stack: e.stack, | ||
}; | ||
} | ||
/* PUBLIC METHODS */ | ||
@@ -165,5 +160,3 @@ /** | ||
if (message instanceof Error) { | ||
log = Object.assign(Object.assign(Object.assign({}, log), this.getContextFromError(message)), { | ||
// Add error message | ||
message: message.message }); | ||
log = Object.assign(Object.assign({}, log), (0, serialize_error_1.serializeError)(message)); | ||
} | ||
@@ -170,0 +163,0 @@ else { |
@@ -24,3 +24,2 @@ import { ILogLevel, ILogtailLog, ILogtailOptions, Context, Middleware, Sync } from "@logtail/types"; | ||
constructor(sourceToken: string, options?: Partial<ILogtailOptions>); | ||
private getContextFromError; | ||
/** | ||
@@ -27,0 +26,0 @@ * Flush batched logs to Logtail |
import { LogLevel, } from "@logtail/types"; | ||
import { makeBatch, makeBurstProtection, makeThrottle } from "@logtail/tools"; | ||
import { serializeError } from "serialize-error"; | ||
// Set default options for Logtail | ||
@@ -81,8 +82,2 @@ const defaultOptions = { | ||
} | ||
/* PRIVATE METHODS */ | ||
getContextFromError(e) { | ||
return { | ||
stack: e.stack, | ||
}; | ||
} | ||
/* PUBLIC METHODS */ | ||
@@ -162,5 +157,3 @@ /** | ||
if (message instanceof Error) { | ||
log = Object.assign(Object.assign(Object.assign({}, log), this.getContextFromError(message)), { | ||
// Add error message | ||
message: message.message }); | ||
log = Object.assign(Object.assign({}, log), serializeError(message)); | ||
} | ||
@@ -167,0 +160,0 @@ else { |
{ | ||
"name": "@logtail/core", | ||
"version": "0.4.14", | ||
"version": "0.4.15", | ||
"description": "Better Stack logging core (formerly Logtail)", | ||
@@ -45,5 +45,6 @@ "keywords": [ | ||
"@logtail/tools": "^0.4.14", | ||
"@logtail/types": "^0.4.14" | ||
"@logtail/types": "^0.4.14", | ||
"serialize-error": "^8.1.0" | ||
}, | ||
"gitHead": "0eaf456a9bf7c2b0c62f0b1dd5015d8491865fff" | ||
"gitHead": "22d60af549eaf1fe1734fce81ea8d6d801b6f8d9" | ||
} |
@@ -11,2 +11,3 @@ import { | ||
import { makeBatch, makeBurstProtection, makeThrottle } from "@logtail/tools"; | ||
import { serializeError } from "serialize-error"; | ||
@@ -150,9 +151,2 @@ // Types | ||
/* PRIVATE METHODS */ | ||
private getContextFromError(e: Error) { | ||
return { | ||
stack: e.stack, | ||
}; | ||
} | ||
/* PUBLIC METHODS */ | ||
@@ -255,7 +249,4 @@ | ||
// Add stack trace | ||
...this.getContextFromError(message), | ||
// Add error message | ||
message: message.message, | ||
// Serialize the error and add to log | ||
...serializeError(message), | ||
}; | ||
@@ -262,0 +253,0 @@ } else { |
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
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
140258
3
2422
+ Addedserialize-error@^8.1.0
+ Addedserialize-error@8.1.0(transitive)
+ Addedtype-fest@0.20.2(transitive)