'use strict';
var Hapi = require('hapi');
var config = require('config');
var mongoose = require('hoist-model')._mongoose;
var router = require('./router');
var _ = require('lodash');

function Server() {

}


Server.prototype.createHapiServer = function () {
  var server = new Hapi.Server();
  server.connection({
    port: config.get('Hoist.http.port')
  });
  router.mapRoutes(server);
  return server;
};
Server.prototype.start = function () {
  mongoose.connect(config.get('Hoist.mongo.db'), _.bind(function () {
    this.hapi = this.createHapiServer();
    this.hapi.start(function () {
      console.log('server started');
    });
  },this));
};
Server.prototype.stop = function (cb) {
  /* istanbul ignore next */
  if (this.hapi) {
    console.log('closing server');
    this.hapi.stop(function () {
      delete this.hapi;
      mongoose.disconnect(function () {
        cb();
      });
    });
  } else {
    cb();
  }
};
module.exports = new Server();

@@ -176,16 +176,54 @@
 odash');
+%0Avar logger = require('hoist-logger');
 %0A%0Afuncti
@@ -631,27 +631,27 @@
 %7B%0A      
-console.log
+logger.info
 ('server
@@ -674,16 +674,17 @@
 %7D);%0A  %7D,
+ 
 this));%0A
@@ -782,35 +782,41 @@
     
-console.log('closing server
+logger.info('server shutting down
 ');%0A
@@ -908,24 +908,64 @@
 nction () %7B%0A
+        logger.info('server shutdown');%0A
         cb()

fix shutdown logic