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.5.0 to 0.6.0

6

dist/transport.d.ts

@@ -31,5 +31,11 @@ /// <reference types="node" />

level?: keyof typeof SeverityIota;
messageAttributeKey?: string;
extraAttributeKeys?: string[];
stackAttributeKey?: string;
}
export declare class PinoSentryTransport {
minimumLogLevel: ValueOf<typeof SeverityIota>;
messageAttributeKey: string;
extraAttributeKeys: string[];
stackAttributeKey: string;
constructor(options?: PinoSentryOptions);

@@ -36,0 +42,0 @@ getLogSeverity(level: keyof typeof SEVERITIES_MAP): Sentry.Severity;

18

dist/transport.js

@@ -67,2 +67,5 @@ "use strict";

this.minimumLogLevel = SeverityIota[Sentry.Severity.Debug];
this.messageAttributeKey = 'msg';
this.extraAttributeKeys = ['extra'];
this.stackAttributeKey = 'stack';
Sentry.init(this.validateOptions(options || {}));

@@ -99,5 +102,10 @@ }

}
const extra = chunk.extra || {};
const message = chunk.msg;
const stack = chunk.stack || '';
const extra = {};
this.extraAttributeKeys.forEach((key) => {
if (chunk[key] !== undefined) {
extra[key] = chunk[key];
}
});
const message = chunk[this.messageAttributeKey];
const stack = chunk[this.stackAttributeKey] || '';
Sentry.configureScope(scope => {

@@ -128,2 +136,3 @@ if (this.isObject(tags)) {

validateOptions(options) {
var _a, _b, _c;
const dsn = options.dsn || process.env.SENTRY_DSN;

@@ -141,2 +150,5 @@ if (!dsn) {

}
this.stackAttributeKey = (_a = options.stackAttributeKey) !== null && _a !== void 0 ? _a : this.stackAttributeKey;
this.extraAttributeKeys = (_b = options.extraAttributeKeys) !== null && _b !== void 0 ? _b : this.extraAttributeKeys;
this.messageAttributeKey = (_c = options.messageAttributeKey) !== null && _c !== void 0 ? _c : this.messageAttributeKey;
return {

@@ -143,0 +155,0 @@ dsn,

2

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

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

@@ -52,2 +52,23 @@

### Override Message Attributes
In case the generated message does not follow the standard convention, the main attribute keys can be mapped to different values, when the stream gets created. Following attribute keys can be overridden:
* `msg`
* `extra`
* `stack`
```js
const { createWriteStream } = require('pino-sentry');
// ...
const opts = { /* ... */ };
const stream = createWriteStream({
dsn: process.env.SENTRY_DSN,
messageAttributeKey: 'message',
stackAttributeKey: 'trace',
extraAttributeKeys: ['req', 'context']
});
const logger = pino(opts, stream);
```
### Transport options

@@ -54,0 +75,0 @@

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