colors are not being stripped from messages and metadata anymore
Opened this issue · 0 comments
nicobleiler commented
#18 seems to have been broken along the way.
require('dotenv').config();
const winston = require('winston');
const LogstashTransport = require("winston-logstash/lib/winston-logstash-latest");
const os = require('os');
// Prepare logging
const logger = winston.createLogger({
level: "debug",
format: winston.format.combine(winston.format.simple(), winston.format.timestamp(), winston.format.colorize()),
defaultMeta: {
environment: process.env.NODE_ENV || "development",
service: 'ephemeral',
host: os.hostname(),
version: require('./package.json').version,
},
transports: [
new winston.transports.File({ filename: 'logs/error.log', level: 'error' }),
new winston.transports.File({ filename: 'logs/combined.log' }),
new winston.transports.Console(),
],
});
if (process.env.LOGSTASH_HOST && process.env.LOGSTASH_PORT && process.env.LOGSTASH_HOST) {
logger.info("Using Logstash");
logger.add(
new LogstashTransport({
port: process.env.LOGSTASH_PORT,
node_name: process.env.LOGSTASH_NODE_NAME,
host: process.env.LOGSTASH_HOST,
max_connect_retries: -1
}),
);
} else {
logger.info("Missing ENV variables to use Logstash");
}
module.exports = {
logger: logger
}