#!/usr/bin/env node
'use strict';

var forever = require('forever-monitor');

var mailinProcess = new (forever.Monitor)('cli.js', {
    max: 3,
    minUptime: 10000,
    options: process.argv
});

mailinProcess.on('error', function (err) {
    console.log(err);
});

mailinProcess.on('restart', function () {
    console.log('Mailin restarted.');
});

mailinProcess.on('exit', function () {
    console.log('Mailin exited.');
});

mailinProcess.start();

@@ -69,16 +69,92 @@
 nitor');
+%0Avar logger = require('./lib/logger');%0A%0Avar pkg = require('./package.json');
 %0A%0Avar ma
@@ -214,9 +214,11 @@
 ax: 
-3
+100
 ,%0A  
@@ -319,108 +319,424 @@
     
-console.log(err);%0A%7D);%0A%0AmailinProcess.on('restart', function () %7B%0A    console.log('Mailin restarted.'
+logger.error('Error caused Mailin to crash.');%0A    logger.error('Please report this to ' + pkg.bugs.url);%0A    logger.error(err);%0A    logger.info();%0A    logger.info();%0A%7D);%0A%0AmailinProcess.on('restart', function () %7B%0A    logger.warn('It is likely that an error caused Mailin to crash.');%0A    logger.warn('Please report this to ' + pkg.bugs.url);%0A    logger.warn('Mailin restarted.');%0A    logger.info();%0A    logger.info(
 );%0A%7D
@@ -786,19 +786,19 @@
     
-console.log
+logger.info
 ('Ma
@@ -802,20 +802,21 @@
 'Mailin 
-exit
+stopp
 ed.');%0A%7D

Use logger