hassio-nextcloud-backup/nextcloud_backup/backend/src/config/winston.ts
2022-09-27 23:38:40 +02:00

27 lines
933 B
TypeScript

import winston from "winston";
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || 'info',
format: winston.format.combine(
winston.format.timestamp({
format: "YYYY-MM-DD HH:mm:ss",
}),
winston.format.errors({ stack: true }),
// winston.format.splat(),
winston.format.colorize(),
winston.format.align(),
winston.format.printf(({ level, message, timestamp }) => {
return `[${timestamp}] [${level}]: ${message}`;
})
),
transports: [
//
// - Write to all logs with level `info` and below to `quick-start-combined.log`.
// - Write all logs error (and below) to `quick-start-error.log`.
//
new winston.transports.Console({ handleExceptions: true }),
// new winston.transports.File({filename: '/data/NCB.log', handleExceptions: true})
],
});
export default logger;