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.

No output on Node.js

See original GitHub issue

Today I tried to use logdown v3.2.2 but when running my script I don’t see log output from logdown. Am I doing something wrong?

const logdown = require('logdown');

const logger = logdown('MyLoggerPrefix', {
  logger: console,
  prefixColor: '#FF0000'
});

logger.log('My log message with logdown.');
console.log('My log message with console.log');

Screenshot

Screenshot

Runkit

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
caiogondimcommented, Jan 8, 2018

The behavior was changed to mimic debuglog which is the NodeJS debugger utility. debug.js mimics it.

As a pattern, we usually set the env before a script, e.g.: https://github.com/reactjs/redux/blob/master/package.json#L26

1reaction
SleepWalkercommented, Dec 29, 2017

Hi, @bennyn. This is because you haven’t set DEBUG or NODE_DEBUG env var (e.g. $ DEBUG=* node ./index.js). As I know this currently expected behavior.

You can try the following snippet to see the difference:

const logdown = require('logdown');

process.env.DEBUG='*';
logdown._setPrefixRegExps(); // this is a hack to force logdown re-parse env vars at runtime

const logger = logdown('MyLoggerPrefix', {
  logger: console,
  prefixColor: '#FF0000'
});

logger.log('My log message with logdown.');
console.log('My log message with console.log');

I think, we can discuss this behavior if it seems to be not that clear or expected

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - NodeJS programs fail, exiting with no output
The problem was that I had a package called "node - Amateur Packet Radio Node program (transitional package)" (note: this is NOT nodejs)...
Read more >
Issue - Node.js run scripts with no output - Plesk Forum
Hi. I have a problem with running Node.js scripts in Plesk. When I run some scripts in the "Run Script" section of the...
Read more >
No output from function node? - General - Node-RED Forum
I'm currently working on it and managed to print everything I want on the console, but once I want to pass it through...
Read more >
Command-line API | Node.js v19.3.0 Documentation
If no corresponding file is found, an error is thrown. If a file is found, ... Set the directory to which all diagnostic...
Read more >
Output to the command line using Node.js
How to print to the command line console using Node.js, from the basic console.log to more complex scenarios. ... Basic output using the...
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