Skip to content
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

Winston Logging Issue: No Stack Trace Printing #53

Open
midblue opened this issue Nov 27, 2019 · 5 comments
Open

Winston Logging Issue: No Stack Trace Printing #53

midblue opened this issue Nov 27, 2019 · 5 comments

Comments

@midblue
Copy link

midblue commented Nov 27, 2019

Hi, I'm having an issue with the Winston logging.
Once I call smashgg.initialize(), all errors are printing without a stack trace, and nothing I do (whether trying to change logs through the smashgg.js-provided functions or through adding transports to the global Winston object) seems to have any effect whatsoever.
Info logs are printing normally.
This has hijacked error logging throughout my application, making it almost impossible to debug without any stack traces. I've tried lots of solutions, but the second I call smashgg.initialize() everything switches over to the broken version.
I've boiled it down to the simplest possible app, and still the issue persists.

Expected behavior:

Error logs that look like this:

s()
^

ReferenceError: s is not defined
    at Object.<anonymous> (/Users/jasper/github/positivity2/index.js:14:1)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
    at internal/main/run_main_module.js:17:11

Actual behavior:

Error logs that look like this:

s is not defined
NOTE: Check your debug log for stack trace
[winston] Attempt to write logs with no transports {"level":"debug"}

Node v12.6.0

index.js

require('dotenv').config()
const smashgg = require('smashgg.js')
const winston = require('winston')
smashgg.disableLog() // has no effect
smashgg.addLog('console', { // also has no effect
  level: 'debug',
  transports: [new winston.transports.Console()],
}) 

// if the initialize line below is commented out, the stack trace prints correctly.
// if not, it prints:
//   s is not defined
//   NOTE: Check your debug log for stack trace
//   [winston] Attempt to write logs with no transports {"level":"debug"}"
smashgg.initialize(process.env.SMASHGG_APIKEY)

s()

package.json

...
"dependencies": {
    "dotenv": "^8.2.0",
    "smashgg.js": "^4.1.10",
    "winston": "^3.2.1" 
  },
...

^ I updated winston to ^3.2.1 just to see if it fixed the issue. The behavior is the same with a fresh install of smashgg.js with no manual Winston updates.

@BrandonCookeDev
Copy link
Owner

I'll take a look at this very soon. Sorry for the delay.

@BrandonCookeDev
Copy link
Owner

@midblue I want to apologize. Due to a significant change in my life, I lost track of this project altogether. Sorry you've had to wait so long for support. I've been trying to find others who can step up in my absence. In any case this is back on my radar, but I can't promise I will be able to jump on it immediately

@midblue
Copy link
Author

midblue commented Feb 13, 2020

@BrandonCookeDev No worries, I ended up coding my own solution so there's no real need on my end anymore. Obviously, if you want to fix it for future users, that's great :)

@BrandonCookeDev
Copy link
Owner

If you can could you submit a PR of your solution if you think it's a universal fix?

@midblue
Copy link
Author

midblue commented Feb 18, 2020

I didn't feel comfortable in TypeScript, so I actually ended up writing a (much worse) custom version of smashgg.js from scratch that fit my needs better. It's not close enough to this project to make a PR feel relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants