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

feat: improve logging #342

Merged
merged 6 commits into from
Dec 16, 2022
Merged

feat: improve logging #342

merged 6 commits into from
Dec 16, 2022

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented Dec 14, 2022

  • feat: log auto-updater messages
  • feat: log station-config messages to log file
  • feat: log Station build version and computer info

Example stdout output:

Log file: /Users/bajtos/Library/Logs/Filecoin Station/main.log
15:10:06.493 (config) › Loading Station configuration from /Users/bajtos/Library/Application Support/Filecoin Station/config.json
15:10:06.526 (main)    › Filecoin Station build version: 0.11.3.1-dev darwin-arm64 [DEV]
15:10:06.527 (main)    › Machine spec: Darwin version 22.1.0
(node:25186) DeprecationWarning: findLogPath() is deprecated and will be removed in v5.

Notice the deprecation warning about findLogPath(). The documentation does not explain what we should use instead of findLogPath() 🙁

With my changes in place, we can improve our UI for reporting problems and allow users to send their electron-log file, too. Perhaps in addition to the Saturn log file. Or we can change the Saturn Module to log messages using electron-log, so that we have everything in one place. Either way, that's out of scope of my PR.

Print the messages to stdout and the log file.

Signed-off-by: Miroslav Bajtoš <[email protected]>
Replace `console.log` with `electron-log`, so that the informational
messages are printed both to stdout and the log file.

Signed-off-by: Miroslav Bajtoš <[email protected]>
@bajtos bajtos requested a review from juliangruber December 14, 2022 10:51
const path = require('node:path')

console.log('Log file:', electronLog.transports.file.findLogPath())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention here is to make it easier to locate the electron-log file when troubleshooting problems. I am using console.log instead of electron-log because it feels redundant to log the filename of the log file into that log file.

Let me know if you thing otherwise!

Rework another console.log in main/station-config.js to call log.info
instead.

Signed-off-by: Miroslav Bajtoš <[email protected]>
main/index.js Outdated Show resolved Hide resolved
@bajtos bajtos force-pushed the feat-updater-logging branch from f3d8350 to f04baca Compare December 14, 2022 14:10
Copy link
Member

@juliangruber juliangruber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@bajtos bajtos merged commit 50ad980 into main Dec 16, 2022
@bajtos bajtos deleted the feat-updater-logging branch December 16, 2022 17:05
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

Successfully merging this pull request may close these issues.

2 participants