1.0.3 • Published 4 years ago

winston-verror-format v1.0.3

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

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