bit of loggin

This commit is contained in:
Karl 2020-05-10 10:02:27 +01:00
parent b2f6c7c64a
commit dcfac6bbeb
3 changed files with 6 additions and 19 deletions

View File

@ -1,14 +0,0 @@
// Load the perfect-logger module
let logger = require('perfect-logger');
module.exports = {
logger: () => {
// Configure Settings
logger.initialize('FrontEndDriver', {
logLevelFile: 0, // Log level for file
logLevelConsole: 0, // Log level for STDOUT/STDERR
logDirectory: 'logs/', // Log directory
customBannerHeaders: 'This is a custom banner' // Custom Log Banner
});
}
}

View File

@ -22,8 +22,9 @@ module.exports = {
}
return res
} catch (error) {
logger.info(error)
logger.info('post error');
logger.warn('-- post error --');
logger.crit(error)
logger.warn('-- post error --');
}
}
}

View File

@ -20,7 +20,7 @@ module.exports = function (app) {
logger.info('POST - /heating/switch - ON - COMPLETE')
res.json(waterStatus)
} catch (error) {
logger.info('POST - /heating/switch - ON - FAILED')
logger.warn('POST - /heating/switch - ON - FAILED')
}
} else if (req.body.switch === 0) {
try {
@ -36,10 +36,10 @@ module.exports = function (app) {
logger.info('POST - /heating/switch - OFF - COMPLETE')
res.json(waterStatus)
} catch (error) {
logger.info('POST - /heating/switch - OFF - FAILED')
logger.warn('POST - /heating/switch - OFF - FAILED')
}
} else {
logger.info('POST - /heating/switch - FAILED')
logger.warn('POST - /heating/switch - FAILED')
}
});