iwmlib/lib/logging.js

24 lines
450 B
JavaScript
Raw Normal View History

2019-05-24 11:02:44 +02:00
let ipc = null
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
*/
static log(message) {
if (ipc) {
ipc.send('log', message)
} else {
console.log(message)
}
2019-05-24 09:53:27 +02:00
}
}