strapi/packages/utils/logger/lib/configs/output-file-configuration.js

21 lines
542 B
JavaScript
Raw Normal View History

2023-01-24 10:59:45 +01:00
'use strict';
const { transports } = require('winston');
const { LEVEL_LABEL, LEVELS } = require('../constants');
const { prettyPrint } = require('../formats');
2023-01-24 11:11:26 +01:00
const { excludeColors } = require('../formats');
2023-01-24 10:59:45 +01:00
const createOutputFileConfiguration = (filename) => {
return {
level: LEVEL_LABEL,
levels: LEVELS,
format: prettyPrint(),
transports: [
new transports.Console(),
new transports.File({ level: 'error', filename, format: excludeColors }),
],
};
};
module.exports = createOutputFileConfiguration;