-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Using ver 1.0.6, I received a "TypeError: HumioTransport is not a constructor" error.
My use case:
const winston = require('winston');
const HumioTransport = require('humio-winston');
const config = require('../config');
const transports = [];
transports.push(
new winston.transports.Console({
level: config.logs.level,
format: winston.format.combine(
winston.format.combine(
winston.format.timestamp(),
winston.format.errors({ stack: true }),
winston.format.splat(),
winston.format.cli(),
winston.format.colorize({ level: true })
)
),
})
);
transports.push(
new winston.transports.File({
filename: `./logs/log_file.log`,
format: winston.format.combine(winston.format.timestamp(), winston.format.splat()),
})
);
transports.push(
new HumioTransport({
ingestToken: proccess.env.humioToken,
callback: err => {
if (err) console.log(err);
},
})
);
I think the problem is in the way the package is being compiled. In my node_modules/humio-winston the humio-winston.js file ended with exports.default = HumioTransport
. I changed it to module.exports = HumioTransport
and everything worked fine.
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
...
class HumioTransport extends winston_transport_1.default {
...
exports.default = HumioTransport;
module.exports = HumioTransport;
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working