Accounting for Windows paths in logger.

This commit is contained in:
DebaucheryLibrarian
2020-09-08 15:44:55 +02:00
parent ac2b7e769d
commit 8aaa88770f
2 changed files with 6 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ require('winston-daily-rotate-file');
const args = require('./argv');
function logger(filepath) {
const root = filepath.match(/src\/|dist\//);
const root = filepath.match(/src[/\\]|dist[/\\]/);
const filename = filepath.slice(root.index + root[0].length)
.replace(path.extname(filepath), '');
@@ -29,7 +29,7 @@ function logger(filepath) {
}),
new winston.transports.DailyRotateFile({
datePattern: 'YYYY-MM-DD',
filename: 'log/%DATE%.log',
filename: path.join('log', '%DATE%.log'),
level: 'silly',
}),
],