Bascule sur le logger Winston
This commit is contained in:
@ -10,8 +10,11 @@ exports.loadProfile = function(profilePath) {
|
||||
|
||||
dispatch({ type: LOAD_PROFILE, profilePath: profilePath });
|
||||
|
||||
Util.Logger.info('Loading profile "%s"', profilePath);
|
||||
|
||||
return Util.System.loadJSON(profilePath)
|
||||
.then(function(profile) {
|
||||
Util.Logger.info('Profile loaded.');
|
||||
dispatch({ type: LOAD_PROFILE_SUCCESS, profile: profile });
|
||||
return profile;
|
||||
})
|
||||
|
@ -1,4 +1,5 @@
|
||||
var Util = require('../../util');
|
||||
var logger = Util.Logger;
|
||||
var path = require('path');
|
||||
var _ = require('lodash');
|
||||
|
||||
@ -21,8 +22,11 @@ var UPDATE_PROFILE_ITEM = exports.UPDATE_PROFILE_ITEM = 'UPDATE_PROFILE_ITEM';
|
||||
// Actions creators
|
||||
|
||||
exports.loadDesktopApps = function() {
|
||||
|
||||
return function(dispatch, getState) {
|
||||
|
||||
logger.info('Loading desktop apps...');
|
||||
|
||||
var baseDirs = global.process.env.XDG_DATA_DIRS.split(':').map(function(baseDir){
|
||||
return path.join(baseDir, 'applications');
|
||||
});
|
||||
@ -31,6 +35,7 @@ exports.loadDesktopApps = function() {
|
||||
|
||||
return Util.DesktopApps.loadAllDesktopFiles(baseDirs)
|
||||
.then(function(desktopApps) {
|
||||
logger.info('Desktop apps loaded.');
|
||||
dispatch({ type: LOAD_DESKTOP_APPS_SUCCESS, desktopApps: desktopApps });
|
||||
})
|
||||
.catch(function(err) {
|
||||
@ -46,6 +51,8 @@ exports.saveProfile = function(destPath, profile) {
|
||||
|
||||
dispatch({ type: SAVE_PROFILE, profile: profile, path: destPath });
|
||||
|
||||
logger.info('Saving profile to "%s"...', destPath);
|
||||
|
||||
var cleanedProfile = _.cloneDeep(profile);
|
||||
|
||||
Util.Tree.walk(cleanedProfile, function(item) {
|
||||
@ -56,6 +63,7 @@ exports.saveProfile = function(destPath, profile) {
|
||||
return Util.System.saveJSON(destPath, cleanedProfile)
|
||||
.then(function() {
|
||||
dispatch({ type: SAVE_PROFILE_SUCCESS, profile: profile, path: destPath });
|
||||
logger.info('Profile saved.');
|
||||
})
|
||||
.catch(function(err) {
|
||||
dispatch({ type: SAVE_PROFILE_FAILED, error: err });
|
||||
|
@ -1,4 +1,5 @@
|
||||
var Util = require('../../util');
|
||||
var logger = Util.Logger;
|
||||
|
||||
var RUN_APP = exports.RUN_APP = 'RUN_APP';
|
||||
var RUN_APP_SUCCESS = exports.RUN_APP_SUCCESS = 'RUN_APP_SUCCESS';
|
||||
@ -8,6 +9,8 @@ exports.runApp = function(execPath) {
|
||||
|
||||
return function(dispatch, getState) {
|
||||
|
||||
logger.info('Launching app "%s"', execPath);
|
||||
|
||||
dispatch({ type: RUN_APP, execPath: execPath });
|
||||
|
||||
return Util.System.runApp(execPath, { clearFreeDesktopFlags: true })
|
||||
|
@ -1,14 +1,14 @@
|
||||
var debug = require('../../util/debug')('store:logger');
|
||||
var logger = require('../../util').Logger;
|
||||
var app = require('../../util').App;
|
||||
|
||||
module.exports = function loggerMiddleware(store) {
|
||||
return function(next) {
|
||||
return function(action) {
|
||||
debug('Action %j', action);
|
||||
//debug('Store current state %j', store.getState());
|
||||
logger.debug('Action', action);
|
||||
next(action);
|
||||
//debug('Store new state %j', store.getState());
|
||||
if(action.error) {
|
||||
console.error(action.error.stack || action.error);
|
||||
logger.error(action.type, action.error);
|
||||
return app.quit(1);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user