Skip to content

Winston@3 verror full stack trace, with all nested errors recursively reported.

License

Notifications You must be signed in to change notification settings

duccio/winston-verror-format

Repository files navigation

Winston@3 verror format

Version npm npm Downloads Dependencies Build Status Codecov Known Vulnerabilities

Winston@3 verror full stack trace, with all nested errors recursively reported as caused by: + err.stack.

Install

npm install winston-verror-format

Usage TypeScript

import { createLogger, format, transports } from "winston";
import { verrorFormat } from "winston-verror-format";
import VError from "verror";

const logger = createLogger({
  format: format.combine(verrorFormat({ stack: true }), format.json()),
  transports: [new transports.Console()],
});

logger.error(new VError(new Error("Error #1"), "Unexpected error"));

Usage JavaScript

const { createLogger, format, transports } = require("winston");
const { verrorFormat } = require("winston-verror-format");
const VError = require("verror");

const logger = createLogger({
  format: format.combine(verrorFormat({ stack: true }), format.json()),
  transports: [new transports.Console()],
});

logger.error(new VError(new Error("Error #1"), "Unexpected error"));

API

verrorFormat(options)

options

Configuration object.

Type: VErrorFormatOptions

options.stack

Save full stack trace as meta stack.

Type: boolean
Default: false

About

Winston@3 verror full stack trace, with all nested errors recursively reported.

Resources

License

Stars

Watchers

Forks

Packages

No packages published