Correction gestion des logs
This commit is contained in:
parent
e5e1748503
commit
f56e2b7f4f
6
main.js
6
main.js
|
@ -2,7 +2,7 @@ var app = require('app'); // Module to control application life.
|
||||||
var BrowserWindow = require('browser-window'); // Module to create native browser window.
|
var BrowserWindow = require('browser-window'); // Module to create native browser window.
|
||||||
var Menu = require('menu');
|
var Menu = require('menu');
|
||||||
var isDev = process.env.NODE_ENV === 'development';
|
var isDev = process.env.NODE_ENV === 'development';
|
||||||
var constants = require('./'+(isDev ? 'src': 'dist')+'/util').Const;
|
var Util = require('./'+(isDev ? 'src': 'dist')+'/util');
|
||||||
|
|
||||||
var mainWindow = null;
|
var mainWindow = null;
|
||||||
|
|
||||||
|
@ -41,3 +41,7 @@ app.on('ready', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
process.on('exit', function(code) {
|
||||||
|
Util.Logger.info('Exiting with code "%s"', code || 0);
|
||||||
|
});
|
||||||
|
|
|
@ -8,7 +8,6 @@ module.exports = function loggerMiddleware(store) {
|
||||||
next(action);
|
next(action);
|
||||||
if(action.error) {
|
if(action.error) {
|
||||||
logger.error(action.type, action.error);
|
logger.error(action.type, action.error);
|
||||||
return app.quit(1);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,12 +6,18 @@ var logFile = process.env.PITAYA_LOG_FILE;
|
||||||
|
|
||||||
logger.level = logLevel;
|
logger.level = logLevel;
|
||||||
|
|
||||||
logger.add(winston.transports.Console, { colorize: true });
|
logger.add(winston.transports.Console, {
|
||||||
|
colorize: true,
|
||||||
|
handleExceptions: true,
|
||||||
|
humanReadableUnhandledException: true
|
||||||
|
});
|
||||||
|
|
||||||
if(logFile) {
|
if(logFile) {
|
||||||
logger.add(winston.transports.File, {
|
logger.add(winston.transports.File, {
|
||||||
filename: logFile,
|
filename: logFile,
|
||||||
json: false
|
json: false,
|
||||||
|
handleExceptions: true,
|
||||||
|
humanReadableUnhandledException: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue