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

pino-sentry

Package Overview
Dependencies
Maintainers
1
Versions
24
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.11.0 to 0.12.0

5

dist/cli.js

@@ -24,5 +24,5 @@ #!/usr/bin/env node

.option('-l, --level <level>', 'The minimum level for a log to be reported to Sentry')
.action(({ dsn, serverName, environment, debug, sampleRate, maxBreadcrumbs, dist, logLevel, maxValueLength, release, level }) => {
.action(({ dsn, serverName, environment, debug, sampleRate, maxBreadcrumbs, dist, maxValueLength, release, level }) => {
try {
const writeStream = transport_1.createWriteStream({
const writeStream = (0, transport_1.createWriteStream)({
dsn,

@@ -35,3 +35,2 @@ serverName,

dist,
logLevel,
maxValueLength,

@@ -38,0 +37,0 @@ release,

2

dist/index.d.ts

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

export { createWriteStream, createWriteStreamAsync, SentryInstance as Sentry } from './transport';
export { createWriteStream, createWriteStreamAsync, SentryInstance as Sentry, PinoSentryOptions, Severity, } from './transport';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Severity = exports.Sentry = exports.createWriteStreamAsync = exports.createWriteStream = void 0;
var transport_1 = require("./transport");

@@ -7,2 +8,3 @@ Object.defineProperty(exports, "createWriteStream", { enumerable: true, get: function () { return transport_1.createWriteStream; } });

Object.defineProperty(exports, "Sentry", { enumerable: true, get: function () { return transport_1.SentryInstance; } });
Object.defineProperty(exports, "Severity", { enumerable: true, get: function () { return transport_1.Severity; } });
//# sourceMappingURL=index.js.map

@@ -6,15 +6,24 @@ /// <reference types="node" />

export declare const SentryInstance: typeof Sentry;
export declare enum Severity {
Fatal = "fatal",
Error = "error",
Warning = "warning",
Log = "log",
Info = "info",
Debug = "debug",
Critical = "critical"
}
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;
readonly 10: Severity.Debug;
readonly 20: Severity.Debug;
readonly 30: Severity.Info;
readonly 40: Severity.Warning;
readonly 50: Severity.Error;
readonly 60: Severity.Fatal;
readonly trace: Severity.Debug;
readonly debug: Severity.Debug;
readonly info: Severity.Info;
readonly warning: Severity.Warning;
readonly error: Severity.Error;
readonly fatal: Severity.Fatal;
};

@@ -30,3 +39,3 @@ declare const SeverityIota: {

};
interface PinoSentryOptions extends Sentry.NodeOptions {
export interface PinoSentryOptions extends Sentry.NodeOptions {
/** Minimum level for a log to be reported to Sentry from pino-sentry */

@@ -38,3 +47,3 @@ level?: keyof typeof SeverityIota;

maxValueLength?: number;
sentryExceptionLevels?: Sentry.Severity[];
sentryExceptionLevels?: Severity[];
decorateScope?: (data: Record<string, unknown>, _scope: Sentry.Scope) => void;

@@ -48,6 +57,6 @@ }

maxValueLength: number;
sentryExceptionLevels: Sentry.Severity[];
sentryExceptionLevels: Severity[];
decorateScope: (_data: Record<string, unknown>, _scope: Sentry.Scope) => void;
constructor(options?: PinoSentryOptions);
getLogSeverity(level: keyof typeof SEVERITIES_MAP): Sentry.Severity;
getLogSeverity(level: keyof typeof SEVERITIES_MAP): Severity;
get sentry(): typeof Sentry;

@@ -54,0 +63,0 @@ transformer(): stream.Transform;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -17,3 +21,3 @@ if (k2 === undefined) k2 = k;

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);

@@ -26,3 +30,3 @@ return result;

Object.defineProperty(exports, "__esModule", { value: true });
exports.createWriteStreamAsync = exports.createWriteStream = exports.PinoSentryTransport = exports.SentryInstance = void 0;
exports.createWriteStreamAsync = exports.createWriteStream = exports.PinoSentryTransport = exports.Severity = exports.SentryInstance = void 0;
const split2_1 = __importDefault(require("split2"));

@@ -40,27 +44,40 @@ const pumpify_1 = __importDefault(require("pumpify"));

}
// Local enum declaration, as @sentry/node deprecated using enums over strings for bundle size
var Severity;
(function (Severity) {
Severity["Fatal"] = "fatal";
Severity["Error"] = "error";
Severity["Warning"] = "warning";
Severity["Log"] = "log";
Severity["Info"] = "info";
Severity["Debug"] = "debug";
// @deprecated: "critical" is not present in sentry 7.x sdk
// https://github.com/getsentry/sentry-javascript/issues/3067
Severity["Critical"] = "critical";
})(Severity = exports.Severity || (exports.Severity = {}));
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,
10: Severity.Debug,
20: Severity.Debug,
30: Severity.Info,
40: Severity.Warning,
50: Severity.Error,
60: 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,
trace: Severity.Debug,
debug: Severity.Debug,
info: Severity.Info,
warning: Severity.Warning,
error: Severity.Error,
fatal: Severity.Fatal,
};
// How severe the Severity is
const SeverityIota = {
[Sentry.Severity.Debug]: 1,
[Sentry.Severity.Log]: 2,
[Sentry.Severity.Info]: 3,
[Sentry.Severity.Warning]: 4,
[Sentry.Severity.Error]: 5,
[Sentry.Severity.Fatal]: 6,
[Sentry.Severity.Critical]: 7,
[Severity.Debug]: 1,
[Severity.Log]: 2,
[Severity.Info]: 3,
[Severity.Warning]: 4,
[Severity.Error]: 5,
[Severity.Fatal]: 6,
[Severity.Critical]: 7,
};

@@ -73,3 +90,3 @@ function get(data, path) {

// Default minimum log level to `debug`
this.minimumLogLevel = SeverityIota[Sentry.Severity.Debug];
this.minimumLogLevel = SeverityIota[Severity.Debug];
this.messageAttributeKey = 'msg';

@@ -79,3 +96,3 @@ this.extraAttributeKeys = ['extra'];

this.maxValueLength = 250;
this.sentryExceptionLevels = [Sentry.Severity.Fatal, Sentry.Severity.Error];
this.sentryExceptionLevels = [Severity.Fatal, Severity.Error];
this.decorateScope = (_data, _scope) => { };

@@ -85,3 +102,3 @@ Sentry.init(this.validateOptions(options || {}));

getLogSeverity(level) {
return SEVERITIES_MAP[level] || Sentry.Severity.Info;
return SEVERITIES_MAP[level] || Severity.Info;
}

@@ -99,3 +116,3 @@ get sentry() {

// Check if we send this Severity to Sentry
if (this.shouldLog(severity) === false) {
if (!this.shouldLog(severity)) {
setImmediate(cb);

@@ -159,3 +176,3 @@ return;

const allowedLevels = Object.keys(SeverityIota);
if (allowedLevels.includes(options.level) === false) {
if (!allowedLevels.includes(options.level)) {
throw new Error(`[pino-sentry] Option \`level\` must be one of: ${allowedLevels.join(', ')}. Received: ${options.level}`);

@@ -197,7 +214,6 @@ }

exports.PinoSentryTransport = PinoSentryTransport;
;
function createWriteStream(options) {
const transport = new PinoSentryTransport(options);
const sentryTransformer = transport.transformer();
return new pumpify_1.default(split2_1.default((line) => {
return new pumpify_1.default((0, split2_1.default)((line) => {
try {

@@ -213,5 +229,4 @@ return JSON.parse(line);

exports.createWriteStream = createWriteStream;
;
// Duplicate to not break API
exports.createWriteStreamAsync = createWriteStream;
//# sourceMappingURL=transport.js.map
{
"name": "pino-sentry",
"description": "@sentry/node transport for pino logger",
"version": "0.11.0",
"author": "Andrew Avdeev <andrewww.avdeev@gmail.com>",

@@ -25,3 +24,3 @@ "keywords": [

"lint": "eslint src/**/*.ts",
"test": "node ./test/test.js",
"test": "jest",
"prepublishOnly": "npm run lint && npm run build && npm run test"

@@ -39,3 +38,3 @@ },

"dependencies": {
"@sentry/node": "^6.2.5",
"@sentry/node": "^6.2.5||^7.1.1",
"commander": "^2.20.0",

@@ -47,3 +46,6 @@ "pumpify": "^2.0.1",

"devDependencies": {
"@jest/types": "^28.1.1",
"@types/jest": "^28.1.1",
"@types/node": "^12.6.9",
"@types/pino": "^6.3.12",
"@types/pumpify": "^1.4.1",

@@ -55,5 +57,9 @@ "@types/split2": "^2.1.6",

"eslint": "^6.8.0",
"jest": "^28.1.1",
"pino": "^6.5.1",
"typescript": "^3.9.7"
}
"ts-jest": "^28.0.4",
"ts-node": "^10.8.1",
"typescript": "^4.7.3"
},
"version": "0.12.0"
}
# pino-sentry
[![CircleCI](https://circleci.com/gh/aandrewww/pino-sentry.svg?style=svg)](https://circleci.com/gh/aandrewww/pino-sentry)
[![node](https://img.shields.io/badge/node-6.4.0+-brightgreen.svg)][node-url]
[![node](https://img.shields.io/badge/node-10.0+-brightgreen.svg)][node-url]
[![license](https://img.shields.io/github/license/aandrewww/pino-sentry.svg)][license-url]

@@ -26,2 +26,11 @@

Note: The v7 version of the Sentry JavaScript SDK requires a self-hosted
version of Sentry 20.6.0 or higher. If you are using a version of self-hosted
Sentry (aka onpremise) older than 20.6.0 then you will need to upgrade. See
[sentry-javascript@7.0.0] release notes.
Alternatively you can pin `@sentry/*` packages to 6.x.
[sentry-javascript@7.0.0]: https://github.com/getsentry/sentry-javascript/releases/tag/7.0.0
## Usage

@@ -86,6 +95,6 @@

- `decorateScope` - option to decorate, manipulate the sentry scope just before the capture
- # `sentryExceptionLevels` - option that represent the levels that will be handled as exceptions. Default : `error` and `fatal`
- `sentryExceptionLevels` - option that represent the levels that will be handled as exceptions. Default : `error` and `fatal`
```js
const { createWriteStream, Sentry } = require("pino-sentry");
const { createWriteStream, Severity } = require("pino-sentry");
// ...

@@ -102,5 +111,5 @@ const opts = {

sentryExceptionLevels: [
Sentry.Severity.Warning,
Sentry.Severity.Error,
Sentry.Severity.Fatal,
Severity.Warning,
Severity.Error,
Severity.Fatal,
],

@@ -107,0 +116,0 @@ decorateScope: (data, scope) => {

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