adding error handling incase the config logging option is not defined

This commit is contained in:
Liran Tal
2014-11-06 13:33:08 +02:00
parent d2d4e8c865
commit 5598caf070

View File

@@ -20,10 +20,14 @@ module.exports = {
getLogOptions: function() {
var options = {};
if ('stream' in config.log.options) {
options = {
stream: fs.createWriteStream(process.cwd() + '/' + config.log.options.stream, {flags: 'a'})
};
try {
if ('stream' in config.log.options) {
options = {
stream: fs.createWriteStream(process.cwd() + '/' + config.log.options.stream, {flags: 'a'})
};
}
} catch (e) {
options = {};
}
return options;