papertrail-winston-transport
v3.0.0-beta.2
Published
A Winston v3 transport for Papertrail
Downloads
331
Maintainers
Readme
papertrail-winston-transport
A Papertrail transport for winston v3.
Papertrail recommends that you use Syslog for use with winston v3, however that has some drawbacks. Namely, Syslog has its own set of log levels, lacking levels like 'silly' and 'verbose'. This library attempts to simplify the Papertrail connection, and can be used as a simple Winston v3 transport.
This is based off of winston-papertrail, which stopped working for winston v3.
⚠ Beta Build
This is a beta build. There may or may not be a few kinks to iron out, but should mostly work as intended. Please create an issue in github if you see anything that needs to be addressed. Thanks!
Installation
Installing
$ npm i papertrail-winston-transport
There are a few required options for logging to Papertrail:
- host: FQDN or IP Address of the Papertrail Service Endpoint
- port: The Endpoint TCP Port
Usage
import winston from "winston"
import { PapertrailTransport } from "papertrail-winston-transport"
const logger = winston.createLogger({
transports: [
new PapertrailTransport({
format: winston.format.combine(
winston.format.colorize({
level: true,
}),
winston.format.simple(),
),
host: "logs.papertrailapp.com",
port: 12345,
}),
],
})
logger.silly("Silly log statement")
logger.debug("Debug log statement")
Some other optional settings:
hostname
- The hostname for your transport.default: os.hostname()
program
- The program for your transport.default: undefined