Skip to content

Commit

Permalink
removed more winston/logger reference
Browse files Browse the repository at this point in the history
  • Loading branch information
soichih committed Jul 17, 2022
1 parent a3747d5 commit 3536fc1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
11 changes: 4 additions & 7 deletions api/health.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@

const redis = require('redis');
const winston = require('winston');

const config = require('../config');
const logger = winston.createLogger(config.logger.winston);
const db = require('./models');
const common = require('./common');

Expand All @@ -12,13 +10,12 @@ const pkg = require('./package.json');
var redis_client = redis.createClient(config.redis.port, config.redis.server);
redis_client.on('error', err=>{throw err});
redis_client.on('ready', ()=>{
logger.info("connected to redis");
console.info("connected to redis");
exports.health_check();
setInterval(exports.health_check, 1000*60); //post health status every minutes
});

exports.health_check = function() {
//logger.debug("running api health check");
var ssh = common.report_ssh();
var report = {
status: "ok",
Expand Down Expand Up @@ -57,15 +54,15 @@ exports.health_check = function() {
report.messages.push('no instance from db');
}

if(report.status != "ok") logger.error(report);
if(report.status != "ok") console.error(report);

//report to redis
redis_client.set("health.amaretti.api."+process.env.HOSTNAME+"-"+process.pid, JSON.stringify(report));
});
//});
} catch(err) {
logger.error("caught exception - probably from ssh_agent issue");
logger.error(err);
console.error("caught exception - probably from ssh_agent issue");
console.error(err);
}
}

Expand Down
2 changes: 0 additions & 2 deletions api/service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

//contrib
const winston = require('winston');
const async = require('async');
const request = require('request'); //deprecate
const axios = require('axios');
Expand Down
2 changes: 0 additions & 2 deletions api/transfer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

//contrib
const winston = require('winston');
const async = require('async');
const sshpk = require('sshpk');
const ConnectionQueuer = require('ssh2-multiplexer');
Expand Down
1 change: 0 additions & 1 deletion api/wf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/node
'use strict';

//var winston = require('winston');
var server = require('./server');
server.start(function(err) {
if(err) throw err;
Expand Down

0 comments on commit 3536fc1

Please sign in to comment.