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

pino-logflare

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-logflare - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1-586e90c4

4

dist/consoleStream.d.ts

@@ -1,5 +0,5 @@

import { LogflareUserOptionsI } from "logflare-transport-core";
declare const createConsoleWriteStream: (options: LogflareUserOptionsI) => {
import { Options } from "./httpStream";
declare const createConsoleWriteStream: (options: Options) => {
write: (chunk: any) => void;
};
export default createConsoleWriteStream;

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

.map(function (chunkItem) { return JSON.parse(chunkItem); })
.map(utils_1.toLogEntry)
.map(function (item) { return utils_1.handlePreparePayload(item, options); })
.map(function (logEntry) {

@@ -14,0 +14,0 @@ return utils_2.addLogflareTransformDirectives(logEntry, options);

import { LogflareUserOptionsI } from "logflare-transport-core";
interface Options extends LogflareUserOptionsI {
export interface PayloadMeta {
cleanedPayload: Record<string, any>;
message?: string;
level?: string;
timestamp?: string;
context: {
host?: string;
service?: string;
pid?: string;
stack?: string;
type?: string;
};
}
export declare type PreparePayloadCallback = (payload: Record<string, any>, meta: PayloadMeta) => Record<string, any>;
export interface Options extends LogflareUserOptionsI {
size?: number;
onPreparePayload?: PreparePayloadCallback;
}
declare function createWriteStream(options: Options): any;
export default createWriteStream;
import createHttpWriteStream from "./httpStream";
import createConsoleWriteStream from "./consoleStream";
import { defaultPreparePayload, extractPayloadMeta } from "./utils";
import { Level, LogEvent } from "./utils";

@@ -13,2 +14,2 @@ import { LogflareUserOptionsI } from "logflare-transport-core";

declare const createWriteStream: typeof createHttpWriteStream;
export { createWriteStream, logflarePinoVercel, createPinoBrowserSend, createConsoleWriteStream, createHttpWriteStream, };
export { createWriteStream, logflarePinoVercel, createPinoBrowserSend, createConsoleWriteStream, createHttpWriteStream, defaultPreparePayload, extractPayloadMeta, };

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.createHttpWriteStream = exports.createConsoleWriteStream = exports.createPinoBrowserSend = exports.logflarePinoVercel = exports.createWriteStream = void 0;
exports.extractPayloadMeta = exports.defaultPreparePayload = exports.createHttpWriteStream = exports.createConsoleWriteStream = exports.createPinoBrowserSend = exports.logflarePinoVercel = exports.createWriteStream = void 0;
var httpStream_1 = __importDefault(require("./httpStream"));

@@ -24,2 +24,5 @@ exports.createHttpWriteStream = httpStream_1.default;

var utils_1 = require("./utils");
Object.defineProperty(exports, "defaultPreparePayload", { enumerable: true, get: function () { return utils_1.defaultPreparePayload; } });
Object.defineProperty(exports, "extractPayloadMeta", { enumerable: true, get: function () { return utils_1.extractPayloadMeta; } });
var utils_2 = require("./utils");
var logflare_transport_core_1 = require("logflare-transport-core");

@@ -33,4 +36,4 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";

return function (level, logEvent) {
var logflareLogEvent = utils_1.formatPinoBrowserLogEvent(logEvent);
var maybeWithTransforms = utils_1.addLogflareTransformDirectives(logflareLogEvent, options);
var logflareLogEvent = utils_2.formatPinoBrowserLogEvent(logEvent);
var maybeWithTransforms = utils_2.addLogflareTransformDirectives(logflareLogEvent, options);
client.postLogEvents([maybeWithTransforms]);

@@ -37,0 +40,0 @@ };

/// <reference types="node" />
import { LogflareUserOptionsI } from "logflare-transport-core";
import { Options } from "./httpStream";
declare function batchStream(size: number): any;
declare function parseJsonStream(): import("stream").Transform;
declare function toLogEntryStream(options: LogflareUserOptionsI): import("stream").Transform;
declare function toLogEntryStream(options: Options): import("stream").Transform;
export { batchStream, parseJsonStream, toLogEntryStream, };

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

return through2_1.default.obj(function (chunk, enc, cb) {
var entry = utils_1.toLogEntry(chunk);
var entry = utils_1.handlePreparePayload(chunk, options);
var maybeWithTransforms = utils_1.addLogflareTransformDirectives(entry, options);

@@ -30,0 +30,0 @@ cb(null, maybeWithTransforms);

import { LogflareUserOptionsI } from "logflare-transport-core";
import { Options, PayloadMeta, PreparePayloadCallback } from "./httpStream";
declare type Level = "fatal" | "error" | "warn" | "info" | "debug" | "trace";

@@ -30,3 +31,5 @@ declare type SerializerFn = (value: any) => any;

declare function addLogflareTransformDirectives(item: Record<string, any>, options: LogflareUserOptionsI): Record<string, any>;
declare function toLogEntry(item: Record<string, any>): Record<string, any>;
export { toLogEntry, formatPinoBrowserLogEvent, Level, LogEvent, addLogflareTransformDirectives, };
export declare const extractPayloadMeta: (item: Record<string, any>) => PayloadMeta;
export declare const defaultPreparePayload: PreparePayloadCallback;
declare const handlePreparePayload: (item: Record<string, any>, options: Options) => Record<string, any>;
export { handlePreparePayload, formatPinoBrowserLogEvent, Level, LogEvent, addLogflareTransformDirectives, };

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.addLogflareTransformDirectives = exports.formatPinoBrowserLogEvent = exports.toLogEntry = void 0;
exports.addLogflareTransformDirectives = exports.formatPinoBrowserLogEvent = exports.handlePreparePayload = exports.defaultPreparePayload = exports.extractPayloadMeta = void 0;
function isObject(value) {

@@ -96,3 +96,3 @@ return typeof value === "object" && value !== null;

function getDocumentUrl() {
if (typeof window !== 'undefined' && typeof window.document !== 'undefined') {
if (typeof window !== "undefined" && typeof window.document !== "undefined") {
return window.document.URL;

@@ -111,3 +111,3 @@ }

exports.addLogflareTransformDirectives = addLogflareTransformDirectives;
function toLogEntry(item) {
var extractPayloadMeta = function (item) {
var status = levelToStatus(item.level);

@@ -120,12 +120,31 @@ var message = item.msg || status;

var type = item.type;
var timestamp = item.time || new Date().getTime();
var _time = item.time, _level = item.level, _msg = item.msg, _hostname = item.hostname, _service = item.service, _pid = item.pid, _stack = item.stack, _type = item.type, cleanedItem = __rest(item, ["time", "level", "msg", "hostname", "service", "pid", "stack", "type"]);
var timestamp = item.time || item.timestamp || new Date().getTime();
var _time = item.time, _level = item.level, _msg = item.msg, _hostname = item.hostname, _service = item.service, _pid = item.pid, _stack = item.stack, _type = item.type, cleanedPayload = __rest(item, ["time", "level", "msg", "hostname", "service", "pid", "stack", "type"]);
var context = removeFalsy({ host: host, service: service, pid: pid, stack: stack, type: type });
return {
metadata: __assign(__assign({}, cleanedItem), { context: context, level: status }),
cleanedPayload: cleanedPayload,
context: context,
timestamp: timestamp,
message: message,
timestamp: timestamp,
level: status,
};
}
exports.toLogEntry = toLogEntry;
};
exports.extractPayloadMeta = extractPayloadMeta;
var defaultPreparePayload = function (_item, meta) {
return {
metadata: __assign(__assign({}, meta.cleanedPayload), { context: meta.context, level: meta.level }),
message: meta.message,
timestamp: meta.timestamp,
};
};
exports.defaultPreparePayload = defaultPreparePayload;
var handlePreparePayload = function (item, options) {
var meta = exports.extractPayloadMeta(item);
var callback = options && options.onPreparePayload
? options.onPreparePayload
: exports.defaultPreparePayload;
var result = callback(item, meta);
return result;
};
exports.handlePreparePayload = handlePreparePayload;
//# sourceMappingURL=utils.js.map
{
"name": "pino-logflare",
"version": "0.4.0",
"version": "0.4.1-586e90c4",
"description": "A transport for Pino that sends messages to Logflare",

@@ -81,2 +81,2 @@ "homepage": "https://github.com/logflare/pino-logflare",

}
}
}

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

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