mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-14 21:42:58 +01:00
27 lines
933 B
TypeScript
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; |