'use strict';

var Verbalize = require('../');
var utils = require('../lib/utils');

module.exports = function(options) {
  return function(app) {
    if (typeof this['logger'] !== 'undefined') return;
    var logger = new Verbalize();
    logger.options = app.options;

    function addMethod(name) {
      app.define(name, {
        enumerable: true,
        configurable: true,
        get: function() {
          return this.logger[name];
        }
      });
    }

    logger.on('addLogger', addMethod);
    logger.on('addMode', addMethod);

    this.define('logger', function() {
      return logger.log.apply(logger, args);
    });

    this.logger.__proto__ = logger;
  };
};

@@ -115,16 +115,78 @@
 ions) %7B%0A
+  var opts = utils.extend(%7BdefaultListener: true%7D, options);%0A%0A
   return
@@ -329,67 +329,402 @@
 ns;%0A
-%0A    function addMethod(name) %7B%0A      app.define(name, %7B%0A  
+    logger.on('addLogger', addMethod);%0A    logger.on('addMode', addMethod);%0A%0A    addMethods(logger.modifiers);%0A    addMethods(logger.modes);%0A%0A    // defaults%0A    logger.addMode('verbose');%0A    logger.addMode('not', %7Btype: 'toggle'%7D);%0A%0A    if (opts.defaultListener === true) %7B%0A      logger.on('*', function(name, stats) %7B%0A        this.handle(stats);%0A      %7D);%0A    %7D%0A%0A    this.define('logger', %7B%0A
     
@@ -739,26 +739,24 @@
 able: true,%0A
-  
       config
@@ -775,18 +775,16 @@
 ,%0A      
-  
 get: fun
@@ -805,165 +805,352 @@
     
-  return this.logger%5Bname%5D;%0A        %7D%0A      %7D);%0A    %7D%0A%0A    logger.on('addL
+function fn() %7B%0A          var args = %5B%5D.slice.call(arguments);%0A          args.unshift('log');%0A          return logger._emit.apply(l
 ogger
-'
 , a
-ddMethod);%0A    logger.on('addMode', addMethod);%0A%0A    this.define('logger',
+rgs);%0A        %7D%0A        fn.__proto__ = logger;%0A        return fn;%0A      %7D%0A    %7D);%0A%0A    function addMethod(name) %7B%0A      app.define(name, %7B%0A        enumerable: true,%0A        configurable: true,%0A        get:
  fun
@@ -1161,24 +1161,28 @@
 n() %7B%0A      
+    
 return logge
@@ -1186,78 +1186,221 @@
 gger
-.log.apply(logger, args);%0A    %7D);%0A%0A    this.logger.__proto__ = logger;
+%5Bname%5D;%0A        %7D%0A      %7D);%0A    %7D%0A%0A    function addMethods(obj) %7B%0A      var methods = Object.keys(obj);%0A      var len = methods.length, i = -1;%0A      while(++i %3C len) %7B%0A        addMethod(methods%5Bi%5D);%0A      %7D%0A    %7D
 %0A  %7D

update base-logger plugin