From dcfac6bbebb8092820be61b7130d6a360f34bfb9 Mon Sep 17 00:00:00 2001 From: Karl Date: Sun, 10 May 2020 10:02:27 +0100 Subject: [PATCH] bit of loggin --- lib/logger.js | 14 -------------- lib/post.js | 5 +++-- routes/water_post.js | 6 +++--- 3 files changed, 6 insertions(+), 19 deletions(-) delete mode 100644 lib/logger.js diff --git a/lib/logger.js b/lib/logger.js deleted file mode 100644 index 60d84ed..0000000 --- a/lib/logger.js +++ /dev/null @@ -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 - }); - } -} \ No newline at end of file diff --git a/lib/post.js b/lib/post.js index 01db451..d09c43a 100644 --- a/lib/post.js +++ b/lib/post.js @@ -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 --'); } } } \ No newline at end of file diff --git a/routes/water_post.js b/routes/water_post.js index ee916f0..c365a31 100644 --- a/routes/water_post.js +++ b/routes/water_post.js @@ -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') } });