-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix: logging and empty config #601
Conversation
Please fix the title of this PR. Examples:
See more in |
const config = JSON.parse(decrypted); | ||
if (Object.keys(config).length === 0) { | ||
logger.log('Empty config file found, returning default config'); | ||
return configExample; | ||
} | ||
return config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fix for my case, when the config somehow became {}
. (Locally on dev env)
log.initialize(); | ||
|
||
// This will transport the logs to the renderer process (DevTools) in production too | ||
log.transports.ipc.level = log.transports.file.level; | ||
|
||
Object.assign(console, log.functions); | ||
const logger = log.scope('main'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialize
: Get all logs from the renderer into the main logger (the renderer can't write to file)transport.ipc
defaults tofalse
for production. Since our users learned to debug the problem with the DevTools, I think it will help to send the main logs into the renderer console.Object.assign(console, log.functions)
to catch also theconsole.log
a
@@ -18,19 +27,20 @@ const onError: MainErrorHandlerOptions['onError'] = ({ error }) => { | |||
logger.error(error.message || error); | |||
if (error.stack) logger.debug(error.stack); | |||
}; | |||
logger.errorHandler.startCatching({ onError }); | |||
logger.catchErrors({ onError }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deprecated
import fs from 'fs'; | ||
import { EOL } from 'os'; | ||
import path from 'path'; | ||
|
||
log.initialize(); | ||
|
||
// This will transport the logs to the renderer process (DevTools) in production too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comment
🎉 This PR is included in version 2.0.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This pull request refactors the logging statements in the codebase to use the logger instead of console.log. This improves the consistency and maintainability of the logging system.
The following commits are included in this pull request:
license package.json
enable logger
Refactor logging statements to use logger instead of console.log