Improve logging.
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
const {ipcRenderer} = require('electron')
|
||||
const fs = require('fs-extra')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const {ipcRenderer} = require('electron')
|
||||
const fs = require('fs-extra')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
|
||||
const ConfigManager = require('./configmanager')
|
||||
const DistroManager = require('./distromanager')
|
||||
const LangLoader = require('./langloader')
|
||||
const logger = require('./loggerutil')('%c[Preloader]', 'color: #a02d2a; font-weight: bold')
|
||||
const ConfigManager = require('./configmanager')
|
||||
const DistroManager = require('./distromanager')
|
||||
const LangLoader = require('./langloader')
|
||||
const { LoggerUtil } = require('helios-core')
|
||||
|
||||
logger.log('Loading..')
|
||||
const logger = LoggerUtil.getLogger('Preloader')
|
||||
|
||||
logger.info('Loading..')
|
||||
|
||||
// Load ConfigManager
|
||||
ConfigManager.load()
|
||||
@@ -21,7 +23,7 @@ function onDistroLoad(data){
|
||||
|
||||
// Resolve the selected server if its value has yet to be set.
|
||||
if(ConfigManager.getSelectedServer() == null || data.getServer(ConfigManager.getSelectedServer()) == null){
|
||||
logger.log('Determining default selected server..')
|
||||
logger.info('Determining default selected server..')
|
||||
ConfigManager.setSelectedServer(data.getMainServer().getID())
|
||||
ConfigManager.save()
|
||||
}
|
||||
@@ -31,26 +33,26 @@ function onDistroLoad(data){
|
||||
|
||||
// Ensure Distribution is downloaded and cached.
|
||||
DistroManager.pullRemote().then((data) => {
|
||||
logger.log('Loaded distribution index.')
|
||||
logger.info('Loaded distribution index.')
|
||||
|
||||
onDistroLoad(data)
|
||||
|
||||
}).catch((err) => {
|
||||
logger.log('Failed to load distribution index.')
|
||||
logger.info('Failed to load distribution index.')
|
||||
logger.error(err)
|
||||
|
||||
logger.log('Attempting to load an older version of the distribution index.')
|
||||
logger.info('Attempting to load an older version of the distribution index.')
|
||||
// Try getting a local copy, better than nothing.
|
||||
DistroManager.pullLocal().then((data) => {
|
||||
logger.log('Successfully loaded an older version of the distribution index.')
|
||||
logger.info('Successfully loaded an older version of the distribution index.')
|
||||
|
||||
onDistroLoad(data)
|
||||
|
||||
|
||||
}).catch((err) => {
|
||||
|
||||
logger.log('Failed to load an older version of the distribution index.')
|
||||
logger.log('Application cannot run.')
|
||||
logger.info('Failed to load an older version of the distribution index.')
|
||||
logger.info('Application cannot run.')
|
||||
logger.error(err)
|
||||
|
||||
onDistroLoad(null)
|
||||
@@ -64,6 +66,6 @@ fs.remove(path.join(os.tmpdir(), ConfigManager.getTempNativeFolder()), (err) =>
|
||||
if(err){
|
||||
logger.warn('Error while cleaning natives directory', err)
|
||||
} else {
|
||||
logger.log('Cleaned natives directory.')
|
||||
logger.info('Cleaned natives directory.')
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user