Bladeren bron

Correction gestion des logs

upgrade-electron
wpetit 4 jaren geleden
bovenliggende
commit
f56e2b7f4f
3 gewijzigde bestanden met toevoegingen van 13 en 4 verwijderingen
  1. +5
    -1
      main.js
  2. +0
    -1
      src/store/middlewares/logger.js
  3. +8
    -2
      src/util/logger.js

+ 5
- 1
main.js Bestand weergeven

@@ -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 Menu = require('menu');
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;

@@ -41,3 +41,7 @@ app.on('ready', function() {
});

});

process.on('exit', function(code) {
Util.Logger.info('Exiting with code "%s"', code || 0);
});

+ 0
- 1
src/store/middlewares/logger.js Bestand weergeven

@@ -8,7 +8,6 @@ module.exports = function loggerMiddleware(store) {
next(action);
if(action.error) {
logger.error(action.type, action.error);
return app.quit(1);
}
};
};

+ 8
- 2
src/util/logger.js Bestand weergeven

@@ -6,12 +6,18 @@ var logFile = process.env.PITAYA_LOG_FILE;

logger.level = logLevel;

logger.add(winston.transports.Console, { colorize: true });
logger.add(winston.transports.Console, {
colorize: true,
handleExceptions: true,
humanReadableUnhandledException: true
});

if(logFile) {
logger.add(winston.transports.File, {
filename: logFile,
json: false
json: false,
handleExceptions: true,
humanReadableUnhandledException: true
});
}


Laden…
Annuleren
Opslaan