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

undefined is logged as null #347

Open
stefansundin opened this issue Feb 5, 2023 · 1 comment
Open

undefined is logged as null #347

stefansundin opened this issue Feb 5, 2023 · 1 comment

Comments

@stefansundin
Copy link
Contributor

Hello,

I tried to search and see if this is intended/documented, but I couldn't find any issue that mentioned it.

When I log undefined, it comes out as null like this:

const log = require('electron-log');

console.log(undefined);
console.log = log.log;
console.log(undefined);

Output in my terminal:

undefined
17:08:28.211 › null

This happens in both 4.4.8 and 5.0.0-beta.16.

Any explanation for this or is it a bug? It threw me for a real loop trying to debug something. 😵‍💫

I made this electron fiddle if you want to test it easily: https://gist.github.com/stefansundin/18ab5af281e820ce15927e126df8712d

Thanks!

@megahertz
Copy link
Owner

It's converted to null when JSON stringified. It would be nice to fix that, but it's a low-priority task currently.

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