12345678910111213141516171819202122232425262728293031 |
- const { format, createLogger, transports } = require("winston");
- const { combine, timestamp, label, printf, prettyPrint } = format;
- const CATEGORY = "winston custom format";
- const config = require("../configs/config.json")
- const logger = createLogger({
- level: "debug",
- format: combine(
- label({ label: CATEGORY }),
- timestamp({
- format: "MMM-DD-YYYY HH:mm:ss",
- }),
- prettyPrint()
- ),
- // transports: [
- // new transports.Console()
- // ],
- transports: [
- //new transports:
- new transports.File({
- filename: config.logfolderpath+"/logs.log",
- }),
- ],
- });
- module.exports = logger;
|