forked from megahertz/electron-log
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (36 loc) · 1.39 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use strict';
var catchErrors = require('./lib/catchErrors');
var log = require('./lib/log');
var transportConsole = require('./lib/transports/console');
var transportFile = require('./lib/transports/file');
var transportRemote = require('./lib/transports/remote');
var transportMainConsole = require('./lib/transports/mainConsole');
var transportRendererConsole = require('./lib/transports/rendererConsole');
var utils = require('./lib/utils');
module.exports = {
catchErrors: function callCatchErrors(options) {
var opts = Object.assign({}, {
log: module.exports.error,
showDialog: process.type === 'browser'
}, options || {});
catchErrors(opts);
},
hooks: [],
isDev: utils.isDev(),
levels: ['error', 'warn', 'info', 'verbose', 'debug', 'silly'],
variables: {
processType: process.type
}
};
module.exports.transports = {
console: transportConsole(module.exports),
file: transportFile(module.exports),
remote: transportRemote(module.exports),
mainConsole: transportMainConsole(module.exports),
rendererConsole: transportRendererConsole(module.exports)
};
module.exports.levels.forEach(function (level) {
module.exports[level] = log.bind(null, module.exports, level);
});
module.exports.log = log.bind(null, module.exports, 'info');
module.exports.default = module.exports;