hassio-nextcloud-backup/nextcloud_backup/backend/src/config/winston.ts

27 lines
933 B
TypeScript
Raw Normal View History

import winston from "winston";
2020-02-15 14:28:48 +01:00
const logger = winston.createLogger({
2021-01-07 16:37:30 +01:00
level: process.env.LOG_LEVEL || 'info',
2020-02-15 14:28:48 +01:00
format: winston.format.combine(
winston.format.timestamp({
2020-11-09 12:42:26 +01:00
format: "YYYY-MM-DD HH:mm:ss",
2020-02-15 14:28:48 +01:00
}),
winston.format.errors({ stack: true }),
2020-02-15 14:28:48 +01:00
// winston.format.splat(),
winston.format.colorize(),
2021-01-05 10:36:44 +01:00
winston.format.align(),
2020-11-09 12:42:26 +01:00
winston.format.printf(({ level, message, timestamp }) => {
2020-02-15 14:28:48 +01:00
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`.
//
2020-11-09 12:42:26 +01:00
new winston.transports.Console({ handleExceptions: true }),
2020-09-12 16:47:55 +02:00
// new winston.transports.File({filename: '/data/NCB.log', handleExceptions: true})
2020-11-09 12:42:26 +01:00
],
2020-02-15 14:28:48 +01:00
});
export default logger;