@speedscale/proxymock
Version:
A free desktop CLI that automatically creates mocks and tests from watching your app run.
36 lines (30 loc) • 837 B
JavaScript
import winston from "winston";
import { join } from "path";
import { INSTALLROOT } from "./constants.js";
const LOG_FILE = join(INSTALLROOT, "npm.log");
// Create winston logger instance
const logger = winston.createLogger({
level: "info",
format: winston.format.combine(
winston.format.timestamp({
format: "YYYY-MM-DDTHH:mm:ss.SSSZ",
}),
winston.format.printf(
({ timestamp, level, message }) =>
`[${timestamp}] [${level.toUpperCase()}] ${message}`,
),
),
transports: [
new winston.transports.File({
filename: LOG_FILE,
handleExceptions: false,
handleRejections: false,
}),
],
exitOnError: false,
});
// Prevent winston from crashing on errors
logger.on("error", () => {
// Silently ignore errors from the winston logger itself
});
export default logger;