winston-verror-format
v1.0.3
Published
Winston@3 verror full stack trace, with all nested errors recursively reported.
Downloads
83
Maintainers
Readme
Winston@3 verror format
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