Skip to content

Commit

Permalink
fix: log messages correctly
Browse files Browse the repository at this point in the history
closes #31
  • Loading branch information
juancarlosfarah committed Apr 30, 2019
1 parent 00a7634 commit c284302
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"snap",
"AppImage"
],
"description": "Example",
"description": "Desktop application for the Graasp ecosystem.",
"category": "Network;Feed",
"publish": [
"github"
Expand Down
36 changes: 18 additions & 18 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ const createWindow = () => {

installExtension(REACT_DEVELOPER_TOOLS)
.then(name => {
console.log(`Added Extension: ${name}`);
log.info(`added extension: ${name}`);
})
.catch(err => {
console.log('An error occurred: ', err);
log.error(err);
});

installExtension(REDUX_DEVTOOLS)
.then(name => {
console.log(`Added Extension: ${name}`);
log.info(`added extension: ${name}`);
})
.catch(err => {
console.log('An error occurred: ', err);
log.error(err);
});
}

Expand All @@ -103,7 +103,7 @@ const createWindow = () => {
};

const handleLoad = () => {
console.log('load');
log.info('load');
};

const generateMenu = () => {
Expand Down Expand Up @@ -239,7 +239,7 @@ app.on('ready', () => {
}
mainWindow.webContents.send(GET_SPACE_CHANNEL, space);
} catch (err) {
console.log('error:', err);
log.error(err);
}
});
ipcMain.on(GET_SPACES_CHANNEL, async () => {
Expand Down Expand Up @@ -277,7 +277,7 @@ app.on('ready', () => {
.then(dl => {
space.asset = `file://${dl.getSavePath()}`;
})
.catch(e => console.log(e, 'error'));
.catch(e => log.error(e));
}
}
}
Expand All @@ -286,7 +286,7 @@ app.on('ready', () => {
}
});
} catch (e) {
console.err(e);
log.error(e);
}
});
ipcMain.on(DELETE_SPACE_CHANNEL, async (event, { id }) => {
Expand Down Expand Up @@ -350,7 +350,7 @@ app.on('ready', () => {
[...spaceDistinctResources].forEach(filePath =>
fs.unlink(filePath, error => {
if (error) {
console.log(error);
log.error(error);
}
})
);
Expand All @@ -372,7 +372,7 @@ app.on('ready', () => {
const extractPath = `${savedSpacesPath}/temp/`;
extract(fileLocation, { dir: extractPath }, async err => {
if (err) {
console.log(err);
log.error(err);
} else {
let space = {};
const spacePath = `${extractPath}/space.json`;
Expand All @@ -384,13 +384,13 @@ app.on('ready', () => {
);
fse.remove(extractPath, removeError => {
if (removeError) {
console.log(removeError);
log.error(removeError);
}
});
} else {
ncp(extractPath, savedSpacesPath, async ncpError => {
if (ncpError) {
return console.error(ncpError);
return log.error(ncpError);
}
let spaces = [];
space = JSON.parse(data);
Expand Down Expand Up @@ -441,12 +441,12 @@ app.on('ready', () => {
}
fs.unlink(`${savedSpacesPath}/space.json`, unlinkError => {
if (unlinkError) {
console.log(unlinkError);
log.error(unlinkError);
}
});
fse.remove(extractPath, removeError => {
if (removeError) {
console.log(removeError);
log.error(removeError);
}
});
}
Expand All @@ -457,7 +457,7 @@ app.on('ready', () => {
}
});
} catch (err) {
console.log('error:', err);
log.error(err);
}
});
ipcMain.on(
Expand Down Expand Up @@ -506,7 +506,7 @@ app.on('ready', () => {
output.on('close', () => {
fs.unlink(ssPath, err => {
if (err) {
console.log(err);
log.error(err);
}
});
mainWindow.webContents.send(EXPORTED_SPACE_CHANNEL);
Expand All @@ -516,7 +516,7 @@ app.on('ready', () => {
});
archive.on('warning', err => {
if (err.code === 'ENOENT') {
console.log(err);
log.error(err);
}
});
archive.on('error', () => {
Expand All @@ -529,7 +529,7 @@ app.on('ready', () => {
});
archive.finalize();
} catch (err) {
console.log(err);
log.error(err);
mainWindow.webContents.send(EXPORTED_SPACE_CHANNEL, ERROR_GENERAL);
}
}
Expand Down

0 comments on commit c284302

Please sign in to comment.