SymphonyElectron/js/log.js

29 lines
580 B
JavaScript
Raw Normal View History

2017-03-01 18:32:21 -06:00
'use strict';
let logWindow;
/**
* Send log messages from main process to logger hosted by
* renderer process. Allows main process to use logger
* provided by JS.
* @param {enum} level enum from ./enums/LogLevel.js
* @param {string} details msg to be logged
*/
function send(level, details) {
if (logWindow && level && details) {
logWindow.send('log', {
2017-04-07 15:13:10 -05:00
level: level,
details: details
2017-03-01 18:32:21 -06:00
});
}
}
function setLogWindow(win) {
logWindow = win;
}
module.exports = {
send: send,
setLogWindow: setLogWindow
};