Socket
Socket
Sign inDemoInstall

pino-sentry

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-sentry - npm Package Compare versions

Comparing version 0.2.6 to 0.3.0

18

dist/transport.d.ts
/// <reference types="node" />
import stream from 'stream';
import * as Sentry from '@sentry/node';
declare const SEVERITIES_MAP: {
readonly 10: Sentry.Severity.Debug;
readonly 20: Sentry.Severity.Debug;
readonly 30: Sentry.Severity.Info;
readonly 40: Sentry.Severity.Warning;
readonly 50: Sentry.Severity.Error;
readonly 60: Sentry.Severity.Fatal;
readonly trace: Sentry.Severity.Debug;
readonly debug: Sentry.Severity.Debug;
readonly info: Sentry.Severity.Info;
readonly warning: Sentry.Severity.Warning;
readonly error: Sentry.Severity.Error;
readonly fatal: Sentry.Severity.Fatal;
};
export declare class PinoSentryTransport {
private SEVERITIES_MAP;
constructor(options?: Sentry.NodeOptions);
getLogSeverity(level: number): Sentry.Severity;
getLogSeverity(level: keyof typeof SEVERITIES_MAP): Sentry.Severity;
readonly sentry: typeof Sentry;

@@ -20,1 +33,2 @@ parse(line: any): void;

};
export {};

60

dist/transport.js

@@ -16,33 +16,31 @@ "use strict";

}
function defaults(target, source) {
const ret = { ...target };
for (const key of Object.keys(source)) {
if (target[key] === undefined) {
ret[key] = source[key];
}
}
return ret;
function writeToStdout() {
return through2_1.default(function (chunk, _enc, cb) {
this.push(chunk);
process.stdout.write(chunk);
cb();
});
}
const SEVERITIES_MAP = {
10: Sentry.Severity.Debug,
20: Sentry.Severity.Debug,
30: Sentry.Severity.Info,
40: Sentry.Severity.Warning,
50: Sentry.Severity.Error,
60: Sentry.Severity.Fatal,
// Support for useLevelLabels
// https://github.com/pinojs/pino/blob/master/docs/api.md#uselevellabels-boolean
trace: Sentry.Severity.Debug,
debug: Sentry.Severity.Debug,
info: Sentry.Severity.Info,
warning: Sentry.Severity.Warning,
error: Sentry.Severity.Error,
fatal: Sentry.Severity.Fatal,
};
class PinoSentryTransport {
constructor(options) {
this.SEVERITIES_MAP = {
10: Sentry.Severity.Debug,
20: Sentry.Severity.Debug,
30: Sentry.Severity.Info,
40: Sentry.Severity.Warning,
50: Sentry.Severity.Error,
60: Sentry.Severity.Fatal,
// Support for useLevelLabels
// https://github.com/pinojs/pino/blob/master/docs/api.md#uselevellabels-boolean
trace: Sentry.Severity.Debug,
debug: Sentry.Severity.Debug,
info: Sentry.Severity.Info,
warning: Sentry.Severity.Warning,
error: Sentry.Severity.Error,
fatal: Sentry.Severity.Fatal,
};
Sentry.init(this.withDefaults(options || {}));
}
getLogSeverity(level) {
return this.SEVERITIES_MAP[level] || Sentry.Severity.Info;
return SEVERITIES_MAP[level] || Sentry.Severity.Info;
}

@@ -99,7 +97,4 @@ get sentry() {

}
withDefaults(options) {
if (!options) {
options = {};
}
return defaults(options, {
withDefaults(options = {}) {
return {
dsn: process.env.SENTRY_DSN || '',

@@ -113,3 +108,4 @@ // npm_package_name will be available if ran with

maxBreadcrumbs: 100,
});
...options,
};
}

@@ -133,3 +129,3 @@ isObject(obj) {

const pumpAsync = pify_1.default(pump_1.default);
return pumpAsync(process.stdin, split2_1.default((line) => {
return pumpAsync(process.stdin.pipe(writeToStdout()), split2_1.default((line) => {
try {

@@ -136,0 +132,0 @@ return JSON.parse(line);

{
"name": "pino-sentry",
"description": "@sentry/node transport for pino logger",
"version": "0.2.6",
"version": "0.3.0",
"author": "Andrew Avdeev <andrewww.avdeev@gmail.com>",

@@ -6,0 +6,0 @@ "keywords": [

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