Skip to content

Winston Logging Issue: No Stack Trace Printing #53

Open
@midblue

Description

@midblue

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions