11
22const redis = require ( 'redis' ) ;
3- const winston = require ( 'winston' ) ;
43
54const config = require ( '../config' ) ;
6- const logger = winston . createLogger ( config . logger . winston ) ;
75const db = require ( './models' ) ;
86const common = require ( './common' ) ;
97
@@ -12,13 +10,12 @@ const pkg = require('./package.json');
1210var redis_client = redis . createClient ( config . redis . port , config . redis . server ) ;
1311redis_client . on ( 'error' , err => { throw err } ) ;
1412redis_client . on ( 'ready' , ( ) => {
15- logger . info ( "connected to redis" ) ;
13+ console . info ( "connected to redis" ) ;
1614 exports . health_check ( ) ;
1715 setInterval ( exports . health_check , 1000 * 60 ) ; //post health status every minutes
1816} ) ;
1917
2018exports . health_check = function ( ) {
21- //logger.debug("running api health check");
2219 var ssh = common . report_ssh ( ) ;
2320 var report = {
2421 status : "ok" ,
@@ -57,15 +54,15 @@ exports.health_check = function() {
5754 report . messages . push ( 'no instance from db' ) ;
5855 }
5956
60- if ( report . status != "ok" ) logger . error ( report ) ;
57+ if ( report . status != "ok" ) console . error ( report ) ;
6158
6259 //report to redis
6360 redis_client . set ( "health.amaretti.api." + process . env . HOSTNAME + "-" + process . pid , JSON . stringify ( report ) ) ;
6461 } ) ;
6562 //});
6663 } catch ( err ) {
67- logger . error ( "caught exception - probably from ssh_agent issue" ) ;
68- logger . error ( err ) ;
64+ console . error ( "caught exception - probably from ssh_agent issue" ) ;
65+ console . error ( err ) ;
6966 }
7067}
7168
0 commit comments