-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
The problem
Configuring format.errors doesn't seem to have any effect. The attached MWE instantiates 3 loggers with different configuration. All seem to result in the same behavior (which is: append error message to log message, and print the stack).
What version of Logform presents the issue?
2.7.0
What version of Node are you using?
v20.18.3
If this is a TypeScript issue, what version of TypeScript are you using?
5.6.3
If this worked in a previous version of Logform, which was it?
No response
Minimum Working Example
import winston, { createLogger, format } from "winston";
const throwError = () => {throw new Error('** error message **')};
const foo = () => throwError();
const someFormat = format.json(); //or prettyPrint. or simple
const withErrors = format.combine(
someFormat,
format.errors({stack: true}),
);
const withErrorsNoStack = format.combine(
someFormat,
format.errors({stack: false}),
);
const transports = [new winston.transports.Console()];
try {
foo();
} catch (e) {
createLogger({format: withErrors, transports}).error('logger with errors(stack:true) :', e);
createLogger({format: withErrorsNoStack, transports}).error('logger with errors(stack:false) :', e);
createLogger({format: someFormat, transports}).error('logger w/o format.errors:', e);
}Additional information
No response
🔎 Search Terms
stack error
Metadata
Metadata
Assignees
Labels
No labels