Logging still sucks.
This commit is contained in:
parent
15bb696b59
commit
00b5efa484
14
app/main.js
14
app/main.js
|
@ -774,13 +774,13 @@ log.transport = createLogger({
|
||||||
new (transports.Console)({
|
new (transports.Console)({
|
||||||
json : false,
|
json : false,
|
||||||
format : combine(
|
format : combine(
|
||||||
//label({ label: 'mcopy-app' }),
|
label({ label: 'mcopy-app' }),
|
||||||
//timestamp(),
|
timestamp(),
|
||||||
//format.colorize({ all: true }),
|
//format.colorize({ all: true }),
|
||||||
//format.splat(),
|
//format.splat(),
|
||||||
//format.json(),
|
//format.json(),
|
||||||
//format.simple(),
|
format.simple(),
|
||||||
log.formatter
|
//log.formatter
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
new (transports.File)({
|
new (transports.File)({
|
||||||
|
@ -796,19 +796,17 @@ log.display = function (obj) {
|
||||||
}
|
}
|
||||||
log.listen = function () {
|
log.listen = function () {
|
||||||
ipcMain.on('log', (event, arg) => {
|
ipcMain.on('log', (event, arg) => {
|
||||||
arg.source = 'renderer'
|
log.transport.info(`[renderer] action=${arg.action} service=${arg.service} status=${arg.status}`)
|
||||||
log.transport.info(arg)
|
|
||||||
event.returnValue = true
|
event.returnValue = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
log.info = function (action, service, status, display) {
|
log.info = function (action, service, status, display) {
|
||||||
var obj = {
|
var obj = {
|
||||||
source: 'main',
|
|
||||||
action : action,
|
action : action,
|
||||||
service : service,
|
service : service,
|
||||||
status : status
|
status : status
|
||||||
}
|
}
|
||||||
log.transport.info(obj)
|
log.transport.info(`[main] action=${action} service=${service} status=${status}`)
|
||||||
if (display) {
|
if (display) {
|
||||||
log.display(obj)
|
log.display(obj)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue