-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid transport, must be an object with a log method #12
Comments
EDIT: Using V2 This snippet of code works for me. const winston = require("winston");
const logzioWinstonTransport = require("winston-logzio");
const winstonFactory = ({ API_TOKEN }) => {
const loggerOptions = {
token: API_TOKEN,
host: "listener.logz.io",
type: "nodejs"
};
winston.add( logzioWinstonTransport, loggerOptions );
return winston;
};
var winstonLogger = winstonFactory({API_TOKEN: 'asd'});
winstonLogger.log('wow') because you haven't shared the full code, const winstonFactory = ({ API_TOKEN }) => {
const winston = require("winston");
const logzioWinstonTransport = require("winston-logzio");
const loggerOptions = {
token: API_TOKEN,
host: "listener.logz.io",
type: "nodejs"
};
winston.add( logzioWinstonTransport, loggerOptions );
return winston;
};
const winstonLogger = winstonFactory({API_TOKEN: 'asd'});
winstonLogger.log('wow'); |
None of the versions work for me and I couldn't say why. Regardless after trying a couple new examples I am not able to communicate with logzio so I think it's safe to say that the issue was in my code and not with the library. Closing this ticket and thanks for contesting! |
@Fl4m3Ph03n1x I think you were using Winston@3 +, Make sure you install Winston@2 |
Downgrading to an older version of winston is not a good solution IMO I believe the solution is related to the number of arguments the "log" function accepts Would a PR for this be accepted? EDIT: apologies just saw winston 3.x ticket |
Having the same issue with |
@Fire-Brand |
@idohalevi From what i've tried, it seems that if i use the example in the README.MD and simply execute that file it does work. When i tried creating my own module with After playing around a bit it seemed that while my |
@Fire-Brand |
Just to clarify, i was using |
@Fire-Brand |
I had to use : |
This worked for me. Thanks. |
This works too:
|
this worked |
worked for me, thanks! |
I have the following code snippet:
const winston = require("winston");
const logzioWinstonTransport = require("winston-logzio");
Upon executing
winstonFactory()
, I get the following error:You can also reproduce the said error by dong this simple tutorial:
https://codeburst.io/setting-up-a-nodejs-monitoring-and-error-alert-system-in-a-jiffy-5241a4ef0561
Am I missing somehting or doing something wrong?
Why isn't it working ?
versions:
NODE: 9.8.0
The text was updated successfully, but these errors were encountered: