2019-05-24 11:02:44 +02:00
|
|
|
let ipc = null
|
2019-05-24 10:29:10 +02:00
|
|
|
|
|
|
|
try {
|
|
|
|
ipc = require('electron').ipcRenderer
|
|
|
|
} catch (e) {}
|
|
|
|
|
2019-05-24 09:53:27 +02:00
|
|
|
/** Basic class for app specific logging requirements.
|
|
|
|
* Can be used to implement persistent logging in electron apps.
|
|
|
|
*/
|
|
|
|
export default class Logging {
|
|
|
|
|
|
|
|
/** Static log function.
|
|
|
|
* @param {*} message
|
|
|
|
*/
|
2019-05-24 10:29:10 +02:00
|
|
|
static log(message) {
|
|
|
|
|
|
|
|
if (ipc) {
|
|
|
|
ipc.send('log', message)
|
|
|
|
} else {
|
|
|
|
console.log(message)
|
|
|
|
}
|
2019-05-24 09:53:27 +02:00
|
|
|
}
|
|
|
|
}
|