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

pino-logflare

Package Overview
Dependencies
Maintainers
1
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.3.8 to 0.3.9-ae4f42f5

4

dist/consoleStream.d.ts

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

/// <reference types="node" />
import stream from "stream";
import { LogflareUserOptionsI } from "logflare-transport-core";
declare const createConsoleWriteStream: (options: LogflareUserOptionsI) => stream.Writable;
declare const createConsoleWriteStream: (options: LogflareUserOptionsI) => any;
export default createConsoleWriteStream;

@@ -8,5 +8,6 @@ "use strict";

var lodash_1 = __importDefault(require("lodash"));
var stream_1 = __importDefault(require("stream"));
var stream_browserify_1 = __importDefault(require("stream-browserify"));
var utils_2 = require("./utils");
var createConsoleWriteStream = function (options) {
var writeStream = new stream_1.default.Writable({
var writeStream = new stream_browserify_1.default.Writable({
objectMode: true,

@@ -20,5 +21,8 @@ highWaterMark: 1,

.map(utils_1.toLogEntry)
.map(function (logEntry) {
return utils_2.addLogflareTransformDirectives(logEntry, options);
})
.map(JSON.stringify)
.forEach(function (x) {
process.stdout.write(x + '\n');
process.stdout.write(x + "\n");
});

@@ -25,0 +29,0 @@ callback();

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

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -29,3 +29,3 @@ return result;

var parseJsonStream = streams.parseJsonStream();
var toLogEntryStream = streams.toLogEntryStream();
var toLogEntryStream = streams.toLogEntryStream(options);
var batchStream = streams.batchStream(size);

@@ -32,0 +32,0 @@ var writeStream = new logflare_transport_core_1.LogflareHttpClient(options).insertStream();

@@ -1,12 +0,11 @@

/// <reference types="node" />
import createHttpWriteStream from "./httpStream";
import createConsoleWriteStream from "./consoleStream";
import { pinoBrowserLogEventI } from "./utils";
import { LogEvent } from "./utils";
import { LogflareUserOptionsI } from "logflare-transport-core";
declare const createPinoBrowserSend: (options: LogflareUserOptionsI) => (level: number, logEvent: pinoBrowserLogEventI) => void;
declare const createPinoBrowserSend: (options: LogflareUserOptionsI) => (level: string | number, logEvent: LogEvent) => void;
declare const logflarePinoVercel: (options: LogflareUserOptionsI) => {
stream: import("stream").Writable;
send: (level: number, logEvent: pinoBrowserLogEventI) => void;
stream: any;
send: (level: string | number, logEvent: LogEvent) => void;
};
declare const createWriteStream: typeof createHttpWriteStream;
export { createWriteStream, logflarePinoVercel, createPinoBrowserSend, createConsoleWriteStream, createHttpWriteStream };
export { createWriteStream, logflarePinoVercel, createPinoBrowserSend, createConsoleWriteStream, createHttpWriteStream, };

@@ -24,7 +24,6 @@ "use strict";

var logflare_transport_core_1 = require("logflare-transport-core");
var isBrowser = typeof window !== 'undefined'
&& typeof window.document !== 'undefined';
var isNode = typeof process !== 'undefined'
&& process.versions != null
&& process.versions.node != null;
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
var isNode = typeof process !== "undefined" &&
process.versions != null &&
process.versions.node != null;
var createPinoBrowserSend = function (options) {

@@ -34,3 +33,4 @@ var client = new logflare_transport_core_1.LogflareHttpClient(__assign(__assign({}, options), { fromBrowser: true }));

var logflareLogEvent = utils_1.formatPinoBrowserLogEvent(logEvent);
client.postLogEvents([logflareLogEvent]);
var maybeWithTransforms = utils_1.addLogflareTransformDirectives(logflareLogEvent, options);
client.postLogEvents([maybeWithTransforms]);
};

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

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

@@ -25,6 +25,7 @@ "use strict";

exports.parseJsonStream = parseJsonStream;
function toLogEntryStream() {
function toLogEntryStream(options) {
return through2_1.default.obj(function (chunk, enc, cb) {
var entry = utils_1.toLogEntry(chunk);
cb(null, entry);
var maybeWithTransforms = utils_1.addLogflareTransformDirectives(entry, options);
cb(null, maybeWithTransforms);
});

@@ -31,0 +32,0 @@ }

@@ -1,12 +0,21 @@

import _ from "lodash";
interface pinoBrowserLogEventI {
import { LogflareUserOptionsI } from "logflare-transport-core";
declare type Level = "fatal" | "error" | "warn" | "info" | "debug" | "trace";
declare type SerializerFn = (value: any) => any;
interface Bindings {
level?: Level | string;
serializers?: {
[key: string]: SerializerFn;
};
[key: string]: any;
}
interface LogEvent {
ts: number;
messages: string[];
bindings: object[];
messages: any[];
bindings: Bindings[];
level: {
label: string;
value: number;
label: string;
};
}
declare const formatPinoBrowserLogEvent: (logEvent: pinoBrowserLogEventI) => {
declare const formatPinoBrowserLogEvent: (logEvent: LogEvent) => {
metadata: {

@@ -20,10 +29,4 @@ url: string;

};
declare function toLogEntry(item: Record<string, any>): {
metadata: {
context: _.Dictionary<any>;
level: string;
};
message: any;
timestamp: any;
};
export { toLogEntry, formatPinoBrowserLogEvent, pinoBrowserLogEventI };
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, LogEvent, addLogflareTransformDirectives, };

@@ -17,4 +17,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.formatPinoBrowserLogEvent = exports.toLogEntry = void 0;
exports.addLogflareTransformDirectives = exports.formatPinoBrowserLogEvent = exports.toLogEntry = void 0;
var lodash_1 = __importDefault(require("lodash"));
var lodash_2 = require("lodash");
function levelToStatus(level) {

@@ -39,9 +40,12 @@ if (level === 10 || level === 20) {

var timestamp = ts;
var logEntry = messages.join(" ");
var objMessages = lodash_1.default.filter(messages, lodash_2.isObject);
var strMessages = lodash_1.default.filter(messages, lodash_2.isString);
var logEntry = strMessages.join(" ");
var defaultMetadata = {
url: window.document.URL,
level: level,
browser: true
browser: true,
};
var metadata = lodash_1.default.reduce(bindings, function (acc, el) {
var bindingsAndMessages = bindings.concat(objMessages);
var metadata = lodash_1.default.reduce(bindingsAndMessages, function (acc, el) {
return Object.assign(acc, el);

@@ -56,2 +60,12 @@ }, defaultMetadata);

exports.formatPinoBrowserLogEvent = formatPinoBrowserLogEvent;
function addLogflareTransformDirectives(item, options) {
var _a;
if ((_a = options === null || options === void 0 ? void 0 : options.transforms) === null || _a === void 0 ? void 0 : _a.numbersToFloats) {
return __assign(__assign({}, item), { "@logflareTransformDirectives": { numbersToFloats: true } });
}
else {
return item;
}
}
exports.addLogflareTransformDirectives = addLogflareTransformDirectives;
function toLogEntry(item) {

@@ -66,3 +80,12 @@ var status = levelToStatus(item.level);

var timestamp = item.time || new Date().getTime();
var cleanedItem = lodash_1.default.omit(item, ["time", "level", "msg", "hostname", "service", "pid", "stack", "type"]);
var cleanedItem = lodash_1.default.omit(item, [
"time",
"level",
"msg",
"hostname",
"service",
"pid",
"stack",
"type",
]);
var context = lodash_1.default.pickBy({ host: host, service: service, pid: pid, stack: stack, type: type }, function (x) { return x; });

@@ -69,0 +92,0 @@ return {

{
"name": "pino-logflare",
"version": "0.3.8",
"version": "0.3.9-ae4f42f5",
"description": "A transport for Pino that sends messages to Logflare",

@@ -69,3 +69,3 @@ "homepage": "https://github.com/logflare/pino-logflare",

"split2": "^3.1.1",
"stream": "0.0.2",
"stream-browserify": "^3.0.0",
"through2": "^3.0.1"

@@ -72,0 +72,0 @@ },

@@ -37,2 +37,6 @@ # pino-logflare

## Known Issues
* Not compatible with `pino-pretty`.
## Credits

@@ -39,0 +43,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

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