BrandonCookeDev / smashgg.js

Node.JS SDK for the Smash.gg public API.
https://www.npmjs.com/package/smashgg.js
34 stars 13 forks source link

accessing the logger doesnt work #34

Closed ghost closed 5 years ago

ghost commented 5 years ago

I want to disable the winston logger but cant seem to access it in the way it is explained in the docs. Seems like:

var smashgg = require('smashgg.js');
smashgg.setLogLevel('warn');

doesnt work, it keeps throwing undfinded error for setLogLevel().

BrandonCookeDev commented 5 years ago

can you please post your error stack? and also post your package.json if you wouldn't mind? What version of smashgg.js are you running?

ghost commented 5 years ago
TypeError: smashgg.setLogLevel is not a function
[0]     at Object.<anonymous> (D:\nodep\smash\server\core\scraper.js:22:9)
[0]     at Module._compile (internal/modules/cjs/loader.js:688:30)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
[0]     at Module.load (internal/modules/cjs/loader.js:598:32)
[0]     at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
[0]     at Function.Module._load (internal/modules/cjs/loader.js:529:3)
[0]     at Module.require (internal/modules/cjs/loader.js:636:17)
[0]     at require (internal/modules/cjs/helpers.js:20:18)
[0]     at Object.<anonymous> (D:\nodep\smash\server\core\dbManage.js:1:79)
[0]     at Module._compile (internal/modules/cjs/loader.js:688:30)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
[0]     at Module.load (internal/modules/cjs/loader.js:598:32)
[0]     at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
[0]     at Function.Module._load (internal/modules/cjs/loader.js:529:3)
[0]     at Module.require (internal/modules/cjs/loader.js:636:17)
[0]     at require (internal/modules/cjs/helpers.js:20:18)
[0]     at Object.<anonymous> (D:\nodep\smash\server\server.js:3:18)
[0]     at Module._compile (internal/modules/cjs/loader.js:688:30)
[0]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
[0]     at Module.load (internal/modules/cjs/loader.js:598:32)
[0]     at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
[0]     at Function.Module._load (internal/modules/cjs/loader.js:529:3)
[0]     at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
[0]     at startup (internal/bootstrap/node.js:285:19)
[0]     at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
BrandonCookeDev commented 5 years ago

What version of smashgg.js are you using? This functionality was introduced in 3.2+ so if you have anything before that you'll get the undefined error.

ghost commented 5 years ago

I updated the dependencies and it works now, thanks alot. How can i disable the logger completely though?

BrandonCookeDev commented 5 years ago

yeah, I didn't really program that in, but I can hotpatch it tonight. For now you can just set the logLevel to 'error' and it will only pop up if an error happens in smashgg.js

BrandonCookeDev commented 5 years ago

I will take some time to hotpatch in disableLogger soon

BrandonCookeDev commented 5 years ago

@L3mmAa issue #35 adds access to disable the logger