diff --git a/main/index.js b/main/index.js index 393594e61..8ccf54fdb 100644 --- a/main/index.js +++ b/main/index.js @@ -1,9 +1,12 @@ 'use strict' const { app, dialog } = require('electron') -const log = require('electron-log') +const electronLog = require('electron-log') const path = require('node:path') +console.log('Log file:', electronLog.transports.file.findLogPath()) +const log = electronLog.scope('main') + // Override the place where we look for config files when running the end-to-end test suite. // We must call this early on, before any of our modules accesses the config store. // https://www.npmjs.com/package/electron-store @@ -23,6 +26,7 @@ const { ActivityLog } = require('./activity-log') const { BUILD_VERSION } = require('./consts') const { JobStats } = require('./job-stats') const { ipcMain } = require('electron/main') +const os = require('os') const saturnNode = require('./saturn-node') const serve = require('electron-serve') const { setupAppMenu } = require('./app-menu') @@ -38,7 +42,12 @@ const { setup: setupDialogs } = require('./dialog') const inTest = (process.env.NODE_ENV === 'test') const isDev = !app.isPackaged && !inTest -console.log('Filecoin Station build version:', BUILD_VERSION) +log.info('Filecoin Station build version: %s %s-%s%s%s', BUILD_VERSION, os.platform(), os.arch(), isDev ? ' [DEV]' : '', inTest ? ' [TEST]' : '') +log.info('Machine spec: %s version %s', os.type(), os.release()) +// TODO(bajtos) print machine architecture after we upgrade to Electron with Node.js 18 +// log.info('Machine spec: %s %s version %s', os.type(), +// os.machine(), +// os.release()) // Expose additional metadata for Electron preload script process.env.STATION_BUILD_VERSION = BUILD_VERSION diff --git a/main/station-config.js b/main/station-config.js index 97499cef1..fa48ae39f 100644 --- a/main/station-config.js +++ b/main/station-config.js @@ -3,6 +3,8 @@ const Store = require('electron-store') const { randomUUID } = require('crypto') +const log = require('electron-log').scope('config') + const ConfigKeys = { OnboardingCompleted: 'station.OnboardingCompleted', TrayOperationExplained: 'station.TrayOperationExplained', @@ -26,11 +28,11 @@ const configStore = new Store({ } }, beforeEachMigration: (_, context) => { - console.log(`Migrating station-config from ${context.fromVersion} → ${context.toVersion}`) + log.info(`Migrating station-config from ${context.fromVersion} → ${context.toVersion}`) } }) -console.log('Loading Station configuration from', configStore.path) +log.info('Loading Station configuration from', configStore.path) let OnboardingCompleted = /** @type {boolean} */ (configStore.get(ConfigKeys.OnboardingCompleted, false)) let TrayOperationExplained = /** @type {boolean} */ (configStore.get(ConfigKeys.TrayOperationExplained, false)) diff --git a/main/updater.js b/main/updater.js index 4e35469ab..e7d3432f7 100644 --- a/main/updater.js +++ b/main/updater.js @@ -29,6 +29,7 @@ function beforeQuitCleanup () { } function setup (/** @type {import('./typings').Context} */ _ctx) { + autoUpdater.logger = log autoUpdater.autoDownload = false // we download manually in 'update-available' autoUpdater.on('error', onUpdaterError)