question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Instantiating logger breaks console.error()

See original GitHub issue

Describe the bug We are using tslog inside Blitz.js. It’s really great, but noticed that it’s causing a regression because it breaks the default behavior of console.error.

Before instantiating a tslog logger, console.error(new Error("Hello")) prints the following:

Error: Hello
    at Test (webpack-internal:///./pages/ssr.tsx:92:17)
    ...redacted

But after instantiating a logger, console.error(new Error("Hello")) prints this:

[Error: Hello]

As you can see, this is very bad because you can’t tell where the error is from.

In this case, third-party code is using console.error, so it’s not something we can change.

To Reproduce Steps to reproduce the behavior:

  1. Run console.error(new Error("Hello"))
  2. See error with stack trace
  3. Instantiate logger: new Logger()
  4. Run console.error(new Error("Hello"))
  5. See there is no stack trace.

Node.js Version Node v12

OS incl. Version

  System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 5.43 GB / 64.00 GB
    Shell: 3.1.2 - /usr/local/bin/fish

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
flybayercommented, Oct 15, 2020

Sweet, thanks! Will test this in Blitz.

2reactions
terehovcommented, Oct 14, 2020

Thank you very much, that was really helpful! I have found and fixed the issue. Just need to update the tests to remain at 100% coverage. Expect an update today or at the latest tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug in console.log? [duplicate] - javascript - Stack Overflow
console.log() prints a reference to the object with as "> Object" when the code is executed · The state of the object when...
Read more >
The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >
Warnings are too "loud", mislabeled and make console difficult ...
My goal is to stop this effectively "breaking" the error console, i.e. making it unusable by flooding it with messages. Possible approaches:.
Read more >
Logging Cookbook — Python 3.11.1 documentation
This class is designed to look like a Logger , so that you can call debug() , info() , warning() , error() ,...
Read more >
{solved} console.log() bug problems - Codecademy
console. log() is a function, it will log/print on the console/screen the message you put in the ( ) . console. log() is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found