export var levels = {
  none: 0,
  error:1,
  warn:2,
  info:3,
  debug:4
};

var loggers = {}, 
    logLevel = levels.none,
    appenders = [],
    slice = Array.prototype.slice,
    loggerConstructionKey = {};

function log(logger, level, args){
  var i = appenders.length, 
          current;

  args = slice.call(args);
  args.unshift(logger);

  while(i--) {
    current = appenders[i];
    current[level].apply(current, args);
  }
}

function debug(){
  if(logLevel < 4){
    return;
  }

  log(this, 'debug', arguments);
}

function info(){
  if(logLevel < 3){
    return;
  }

  log(this, 'info', arguments);
}

function warn(){
  if(logLevel < 2){
    return;
  }

  log(this, 'warn', arguments);
}

function error(){
  if(logLevel < 1){
    return;
  }

  log(this, 'error', arguments);
}

function connectLogger(logger){
  logger.debug = debug;
  logger.info = info;
  logger.warn = warn;
  logger.error = error;
}

function createLogger(id){
  var logger = new Logger(id, loggerConstructionKey);

  if(appenders.length) {
    connectLogger(logger);  
  }

  return logger;
}

export function getLogger(id){
  return loggers[id] || (loggers[id] = createLogger(id));
}

export function addAppender(appender){
  appenders.push(appender);

  if(appenders.length === 1){
    for(var key in loggers){
      connectLogger(loggers[key]);
    }
  }
}

export function setLevel(level){
  logLevel = level;
}

export class Logger {
  constructor(id, key){
    if(key !== loggerConstructionKey){
      throw new Error('You cannot instantiate "Logger". Use the "getLogger" API instead.');
    }

    this.id = id;
  }

  debug(){}
  info(){}
  warn(){}
  error(){}
}
@@ -1,12 +1,295 @@
+/**%0A * This library is part of the Aurelia platform and contains a minimal but effective logging mechanism%0A * with support for log levels and pluggable log appenders.%0A *%0A * @module logging%0A */%0A%0A /**%0A * Enum specifying the levels of the logger%0A* %0A* @property levels%0A* @type %7BEnum%7D%0A*/%0A
 export var l
@@ -1360,24 +1360,260 @@
  logger;%0A%7D%0A%0A
+%EF%BB%BF/**%0A * Gets an instance of a logger by the Id used when creating.%0A * Returns the instance of the logger, or creates a new logger if none exists for that Id.%0A * @param %7Bint%7D id - The id of the logger you wish to get an instance of.%0A */%0A
 export funct
@@ -1871,63 +1871,664 @@
 %0A%7D%0A%0A
-export function setLevel(level)%7B%0A  logLevel = level;%0A%7D%0A
+%EF%BB%BF/**%0A * Sets the level of the logging for the application loggers%0A * @param %7Bint%7D level - matches an enum specifying the level of logging.%0A */%0Aexport function setLevel(level)%7B%0A  logLevel = level;%0A%7D%0A%0A/**%0A* The logging module encapsulates all logic related to logging.%0A* The logger is essentially responsible for having log statements that appear during debugging but are squelched%0A* when using the build tools, depending on the log level that is set.  The available levels are -%0A* 1. none%0A* 2. error%0A* 3. warn%0A* 4. info%0A* 5. debug%0A* you cannot instantiate the logger directly - you must use the getLogger method instead.*%0A*%0A* @class Logger%0A* @constructor%0A*/
 %0Aexp

add first pass of api docs