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.

Nothing Happening

See original GitHub issue

Electron: 1.7.9 Nodejs: 9.2.0 OS: Windows 10

I have installed electron-log

npm install --save electron-log

I have included the module

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

Yet upon attempting to log something

log.info('Hello, log - info'); log.warn('Hello, log - warning');

Absolutely nothing is happening. No errors are occuring, no log messages in console, and no file is being created where the documentation suggests it should be created:

%USERPROFILE%\AppData\Roaming\<app name>\log.log

Are you able to confirm this is working in node 9.2.0?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

11reactions
phuzecommented, Nov 22, 2017

Okay so through some testing I’ve discovered few things – I will admit your documentation is a little misleading – but maybe thats just my interpretation of it. Posting the default behavior in the event this helps anyone else:

To use this in main.js, you must include as:

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

Outside of main.js, include as such:

var log = require('electron-log/renderer');

By default, only .error and .warn will result in output to the local file.

log.error('this is an error');
log.warn('this is a warning');

To help showcase where each log level gets written by default, I used the following test block:

log.error('test');
log.warn('test');
log.info('test');
log.verbose('test');
log.debug('test');
log.silly('test');

If used within the main process:

main console: error, warn, info, verbose, debug, silly render console: -none- local file: error, warn

If used outside the main process:

main console: error, warn, info, verbose, debug, silly render console: error, warn, info, verbose local file: error, warn

You can disable logging to console, from the main process, as such:

log.transports.console.level = false;

However, if you attempt to disable console level logging within a render process, it breaks. If you wish to disable console level logging in a render process, you will need to include electron-log like this instead:

var electronRemote = require('electron').remote;
var log = electronRemote.require('electron-log');
log.transports.console.level = false;

Personally, I find it odd that logs within the render process, are also logged to the main process console. I also feel like your documentation could use some clarification.

2reactions
wjljackcommented, Dec 5, 2017

Nothing Happening +1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nothing Happening: Lennon, Lisa - Amazon.com
Finally, the book that many have been waiting for, is here. Whether you're feeling stuck, tired of seeking or just in love with...
Read more >
Nothing Happens - Album by Wallows - Spotify
Nothing Happens. Wallows. 201911 songs, 38 min 51 sec. 1. Only FriendWallows. 2. Treacherous DoctorWallows. 3. SidelinesWallows. 4. Are You Bored Yet?
Read more >
Nothing Happening - Beavis and Butt-Head Wiki - Fandom
Nothing Happening is the 15th episode in Season 7 of Beavis and Butt-head. It is the overall 177th episode. It first aired on...
Read more >
Nothing Happens (album) - Wikipedia
Nothing Happens is the debut studio album by American band Wallows. It was released on March 22, 2019 through Atlantic Records.
Read more >
Nothing-happening GIFs - Get the best GIF on GIPHY
Explore and share the best Nothing-happening GIFs and most popular animated GIFs here on GIPHY. Find Funny GIFs, Cute GIFs, Reaction GIFs and...
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