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.12-f80d45e0 to 0.3.12-f8fd9483

9

dist/consoleStream.js

@@ -7,3 +7,2 @@ "use strict";

var utils_1 = require("./utils");
var lodash_1 = __importDefault(require("lodash"));
var stream_browserify_1 = __importDefault(require("stream-browserify"));

@@ -18,9 +17,9 @@ var utils_2 = require("./utils");

var batch = Array.isArray(chunk) ? chunk : [chunk];
lodash_1.default(batch)
.map(JSON.parse)
batch
.map(function (chunkItem) { return JSON.parse(chunkItem); })
.map(utils_1.toLogEntry)
.map(function (logEntry) {
return utils_2.addLogflareTransformDirectives(logEntry, options);
return (0, utils_2.addLogflareTransformDirectives)(logEntry, options);
})
.map(JSON.stringify)
.map(function (chunkItem) { return JSON.stringify(chunkItem); })
.forEach(function (x) {

@@ -27,0 +26,0 @@ process.stdout.write(x + "\n");

@@ -31,4 +31,4 @@ "use strict";

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

@@ -40,3 +40,3 @@ };

return {
stream: consoleStream_1.default(options),
stream: (0, consoleStream_1.default)(options),
send: createPinoBrowserSend(options),

@@ -43,0 +43,0 @@ };

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

function parseJsonStream() {
return split2_1.default(function (str) {
var result = fast_json_parse_1.default(str);
return (0, split2_1.default)(function (str) {
var result = (0, fast_json_parse_1.default)(str);
if (result.err)

@@ -28,4 +28,4 @@ return;

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

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

@@ -13,9 +13,45 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addLogflareTransformDirectives = exports.formatPinoBrowserLogEvent = exports.toLogEntry = void 0;
var lodash_1 = __importDefault(require("lodash"));
var lodash_2 = require("lodash");
function isObject(value) {
return typeof value === "object" && value !== null;
}
function isString(value) {
return typeof value === "string";
}
/**
* Takes an object and removes all falsy properties
*/
function removeFalsy(input) {
if (input === null || input === undefined) {
return input;
}
if (typeof input === "object" && input !== null) {
var key = void 0;
for (key in input) {
var value = input[key];
if (!value) {
delete input[key];
}
else if (typeof value === "object") {
removeFalsy(value);
if (!Object.keys(value).length) {
delete input[key];
}
}
}
}
return input;
}
function levelToStatus(level) {

@@ -40,4 +76,4 @@ if (level === 10 || level === 20) {

var timestamp = ts;
var objMessages = lodash_1.default.filter(messages, lodash_2.isObject);
var strMessages = lodash_1.default.filter(messages, lodash_2.isString);
var objMessages = messages.filter(isObject);
var strMessages = messages.filter(isString);
var logEntry = strMessages.join(" ");

@@ -50,3 +86,3 @@ var defaultMetadata = {

var bindingsAndMessages = bindings.concat(objMessages);
var metadata = lodash_1.default.reduce(bindingsAndMessages, function (acc, el) {
var metadata = bindingsAndMessages.reduce(function (acc, el) {
return Object.assign(acc, el);

@@ -80,13 +116,4 @@ }, defaultMetadata);

var timestamp = item.time || new Date().getTime();
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; });
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 context = removeFalsy({ host: host, service: service, pid: pid, stack: stack, type: type });
return {

@@ -93,0 +120,0 @@ metadata: __assign(__assign({}, cleanedItem), { context: context, level: status }),

{
"name": "pino-logflare",
"version": "0.3.12-f80d45e0",
"version": "0.3.12-f8fd9483",
"description": "A transport for Pino that sends messages to Logflare",

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

"@babel/preset-typescript": "^7.10.1",
"@types/lodash": "^4.14.157",
"@types/node": "^14.0.14",

@@ -65,3 +64,2 @@ "@types/pumpify": "^1.4.1",

"fast-json-parse": "^1.0.3",
"lodash": "^4.17.15",
"logflare-transport-core": "^0.2.5",

@@ -68,0 +66,0 @@ "pino": "^6.3.2",

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