1.5.0 • Published 5 months ago
pino-sentry-transport v1.5.0
Pino Sentry transport
Pino Sentry Transport allows you to send logs from Pino directly to Sentry.
Installation
npm i pino-sentry-transport
Usage
import pino from "pino";
const logger = pino({
transport: {
target: "pino-sentry-transport",
options: {
sentry: {
dsn: "https://<key>:<secret>@sentry.io/<project>",
// additional options for sentry
},
withLogRecord: true, // default false - send the entire log record to sentry as a context.(FYI if its more then 8Kb Sentry will throw an error)
tags: ['level'], // sentry tags to add to the event, uses lodash.get to get the value from the log record
context: ['hostname'], // sentry context to add to the event, uses lodash.get to get the value from the log record,
minLevel: 40, // which level to send to sentry
expectPinoConfig: true, // default false - pass true if pino configured with custom messageKey or errorKey see below
}
},
});
Configuration Options
withLogRecord
: When set totrue
, sends the entire log record as context to Sentry. Be cautious of log records larger than 8KB, as Sentry will throw an error.tags
: An array specifying which fields from the log record should be added as tags in Sentry. Useslodash.get
to extract values.context
: An array specifying which fields from the log record should be added as context in Sentry. Also useslodash.get
for value extraction.minLevel
: The minimum log level required for a message to be sent to Sentry. Log levels follow Pino's conventions (e.g., 40 for 'error').expectPinoConfig
: If set totrue
, allows the transport to work with custommessageKey
orerrorKey
settings in Pino.
Sentry initialization
Because Pino transport runs in a separate worker thread, Sentry needs to be initialized in the transport.
License
This project is licensed under the MIT License - see the LICENSE file for details.
1.5.0
5 months ago
1.3.1-alpha.1
11 months ago
1.3.1-alpha.0
11 months ago
1.4.0
10 months ago
1.2.0
1 year ago
1.3.0
1 year ago
1.1.1-next.0
1 year ago
1.2.1-alpha.0
1 year ago
1.2.1-alpha.1
1 year ago
1.1.0
1 year ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago
1.0.3
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago
0.0.1
3 years ago
0.0.0-development
3 years ago