24 lines
450 B
JavaScript
24 lines
450 B
JavaScript
let ipc = null
|
|
|
|
try {
|
|
ipc = require('electron').ipcRenderer
|
|
} catch (e) {}
|
|
|
|
/** 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
|
|
*/
|
|
static log(message) {
|
|
|
|
if (ipc) {
|
|
ipc.send('log', message)
|
|
} else {
|
|
console.log(message)
|
|
}
|
|
}
|
|
}
|