Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@logtail/core

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logtail/core - npm Package Compare versions

Comparing version 0.4.21 to 0.5.0

6

dist/cjs/base.js

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

visitedObjects.add(value);
const serializedArray = value.map(item => this.serialize(item, maxDepth - 1, visitedObjects));
const serializedArray = value.map((item) => this.serialize(item, maxDepth - 1, visitedObjects));
visitedObjects.delete(value);

@@ -242,3 +242,3 @@ return serializedArray;

visitedObjects.add(value);
Object.entries(value).forEach(item => {
Object.entries(value).forEach((item) => {
const key = item[0];

@@ -330,3 +330,3 @@ const value = item[1];

remove(fn) {
this._middleware = this._middleware.filter(p => p !== fn);
this._middleware = this._middleware.filter((p) => p !== fn);
}

@@ -333,0 +333,0 @@ }

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

// Expect logging to throw an error, since we're missing a `sync` func
await expect(base.log("Test")).rejects.toThrowError(/sync/);
await expect(base.log("Test")).rejects.toThrow(/sync/);
});

@@ -57,3 +57,3 @@ it("should add an implicit `dt` timestamp", async () => {

base.setSync(async (log) => {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => {

@@ -84,3 +84,3 @@ resolve(log);

base.setSync(async (log) => {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => {

@@ -316,3 +316,3 @@ resolve(log);

base.setSync(async (logs) => {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => resolve(logs), 100);

@@ -355,3 +355,3 @@ });

// Wait for 1ms after every log
await new Promise(resolve => setTimeout(resolve, 1));
await new Promise((resolve) => setTimeout(resolve, 1));
}

@@ -382,3 +382,3 @@ await Promise.all(logs);

// Send logs with 1ms delay between them
logs.push(new Promise(resolve => {
logs.push(new Promise((resolve) => {
setTimeout(() => base.info(message).then(resolve), i);

@@ -385,0 +385,0 @@ }));

@@ -232,3 +232,3 @@ import { LogLevel } from "@logtail/types";

visitedObjects.add(value);
const serializedArray = value.map(item => this.serialize(item, maxDepth - 1, visitedObjects));
const serializedArray = value.map((item) => this.serialize(item, maxDepth - 1, visitedObjects));
visitedObjects.delete(value);

@@ -240,3 +240,3 @@ return serializedArray;

visitedObjects.add(value);
Object.entries(value).forEach(item => {
Object.entries(value).forEach((item) => {
const key = item[0];

@@ -328,3 +328,3 @@ const value = item[1];

remove(fn) {
this._middleware = this._middleware.filter(p => p !== fn);
this._middleware = this._middleware.filter((p) => p !== fn);
}

@@ -331,0 +331,0 @@ }

@@ -12,3 +12,3 @@ import Base from "./base";

// Expect logging to throw an error, since we're missing a `sync` func
await expect(base.log("Test")).rejects.toThrowError(/sync/);
await expect(base.log("Test")).rejects.toThrow(/sync/);
});

@@ -52,3 +52,3 @@ it("should add an implicit `dt` timestamp", async () => {

base.setSync(async (log) => {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => {

@@ -79,3 +79,3 @@ resolve(log);

base.setSync(async (log) => {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => {

@@ -311,3 +311,3 @@ resolve(log);

base.setSync(async (logs) => {
return new Promise(resolve => {
return new Promise((resolve) => {
setTimeout(() => resolve(logs), 100);

@@ -350,3 +350,3 @@ });

// Wait for 1ms after every log
await new Promise(resolve => setTimeout(resolve, 1));
await new Promise((resolve) => setTimeout(resolve, 1));
}

@@ -377,3 +377,3 @@ await Promise.all(logs);

// Send logs with 1ms delay between them
logs.push(new Promise(resolve => {
logs.push(new Promise((resolve) => {
setTimeout(() => base.info(message).then(resolve), i);

@@ -380,0 +380,0 @@ }));

{
"name": "@logtail/core",
"version": "0.4.21",
"version": "0.5.0",
"description": "Better Stack logging core (formerly Logtail)",

@@ -39,12 +39,8 @@ "keywords": [

},
"devDependencies": {
"npm-run-all": "^4.1.5",
"typescript": "^4.9.5"
},
"dependencies": {
"@logtail/tools": "^0.4.21",
"@logtail/types": "^0.4.20",
"serialize-error": "^8.1.0"
"@logtail/tools": "^0.5.0",
"@logtail/types": "^0.5.0",
"serialize-error": "8.1.0"
},
"gitHead": "8631392d3c7a619a45911ba33ca7ca6b3038e878"
"gitHead": "206d52b85903715541e5acbb5b5f1c63298b0714"
}

@@ -80,3 +80,3 @@ # [Better Stack](https://betterstack.com/logs) JavaScript client: Logging core library

// Will resolve when synced with Better Stack (or reject if there's an error)
logtail.log("some log message").then(log => {
logtail.log("some log message").then((log) => {
// `log` is the transformed log, after going through middleware

@@ -83,0 +83,0 @@ });

@@ -16,3 +16,3 @@ import Base from "./base";

// Expect logging to throw an error, since we're missing a `sync` func
await expect(base.log("Test")).rejects.toThrowError(/sync/);
await expect(base.log("Test")).rejects.toThrow(/sync/);
});

@@ -26,3 +26,3 @@

// Add a mock sync method
base.setSync(async logs => logs);
base.setSync(async (logs) => logs);

@@ -61,3 +61,3 @@ // Pass the log through the `.log()` function and get the result

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -74,4 +74,4 @@ void (await base.log("Test"));

// Create a sync function that resolves after 500ms
base.setSync(async log => {
return new Promise<ILogtailLog[]>(resolve => {
base.setSync(async (log) => {
return new Promise<ILogtailLog[]>((resolve) => {
setTimeout(() => {

@@ -108,4 +108,4 @@ resolve(log);

// Create a sync function that resolves after 50ms
base.setSync(async log => {
return new Promise<ILogtailLog[]>(resolve => {
base.setSync(async (log) => {
return new Promise<ILogtailLog[]>((resolve) => {
setTimeout(() => {

@@ -139,3 +139,3 @@ resolve(log);

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -146,3 +146,3 @@ // Message to replacement with

// Add a custom pipeline that replaces `message`
base.use(async log => {
base.use(async (log) => {
return {

@@ -186,3 +186,3 @@ ...log,

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -202,3 +202,3 @@ // Log

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -218,3 +218,3 @@ // Log

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -234,3 +234,3 @@ // Log

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -250,3 +250,3 @@ // Log

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -267,3 +267,3 @@ // Log

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -319,3 +319,3 @@ // Log

let logsCount = 0;
base.setSync(async logs => {
base.setSync(async (logs) => {
syncCount++;

@@ -345,3 +345,3 @@ logsCount = logs.length;

let syncCount = 0;
base.setSync(async log => {
base.setSync(async (log) => {
syncCount++;

@@ -377,3 +377,3 @@ return log;

// Add a mock sync method
base.setSync(async log => log);
base.setSync(async (log) => log);

@@ -426,4 +426,4 @@ // Mock console methods

// Add a mock sync method which resolves after a timeout
base.setSync(async logs => {
return new Promise<ILogtailLog[]>(resolve => {
base.setSync(async (logs) => {
return new Promise<ILogtailLog[]>((resolve) => {
setTimeout(() => resolve(logs), 100);

@@ -467,3 +467,3 @@ });

// Add a mock sync method
base.setSync(async logs => logs);
base.setSync(async (logs) => logs);

@@ -479,3 +479,3 @@ // Mock console.error()

// Wait for 1ms after every log
await new Promise(resolve => setTimeout(resolve, 1));
await new Promise((resolve) => setTimeout(resolve, 1));
}

@@ -504,3 +504,3 @@

// Add a mock sync method
base.setSync(async logs => logs);
base.setSync(async (logs) => logs);

@@ -516,3 +516,3 @@ // Mock console.error()

logs.push(
new Promise(resolve => {
new Promise((resolve) => {
setTimeout(() => base.info(message).then(resolve), i);

@@ -548,3 +548,3 @@ }),

// Add a mock sync method
base.setSync(async logs => logs);
base.setSync(async (logs) => logs);

@@ -551,0 +551,0 @@ // Mock console.error()

@@ -324,3 +324,3 @@ import { ILogLevel, ILogtailLog, ILogtailOptions, Context, LogLevel, Middleware, Sync } from "@logtail/types";

visitedObjects.add(value);
const serializedArray = value.map(item => this.serialize(item, maxDepth - 1, visitedObjects));
const serializedArray = value.map((item) => this.serialize(item, maxDepth - 1, visitedObjects));
visitedObjects.delete(value);

@@ -334,3 +334,3 @@

Object.entries(value).forEach(item => {
Object.entries(value).forEach((item) => {
const key = item[0];

@@ -430,3 +430,3 @@ const value = item[1];

public remove(fn: Middleware): void {
this._middleware = this._middleware.filter(p => p !== fn);
this._middleware = this._middleware.filter((p) => p !== fn);
}

@@ -433,0 +433,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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