Skip to content

Commit

Permalink
chore(all): prepare release 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Apr 9, 2015
1 parent ffe2e20 commit 83c228c
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 398 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-logging",
"version": "0.2.7",
"version": "0.3.0",
"description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.",
"keywords": [
"aurelia",
Expand Down
166 changes: 34 additions & 132 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,16 @@
define(["exports"], function (exports) {
"use strict";

var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

/**
* This library is part of the Aurelia platform and contains a minimal but effective logging mechanism
* with support for log levels and pluggable log appenders.
*
* @module logging
*/

/**
* Creates an instance of Error that aggregates and preserves an innerError.
*
* @class AggregateError
* @constructor
*/
exports.AggregateError = AggregateError;
define(['exports'], function (exports) {
'use strict';

/**
* Gets an instance of a logger by the Id used when creating.
*
* @method getLogger
* @param {string} id The id of the logger you wish to get an instance of.
* @return {Logger} The instance of the logger, or creates a new logger if none exists for that Id.
* @for export
*/
exports.getLogger = getLogger;
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };

/**
* Adds an appender capable of processing logs and channeling them to an output.
*
* @method addAppender
* @param {Object} appender An appender instance to begin processing logs with.
* @for export
*/
exports.addAppender = addAppender;
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

/**
* Sets the level of the logging for the application loggers
*
* @method setLevel
* @param {Number} level Matches an enum specifying the level of logging.
* @for export
*/
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.AggregateError = AggregateError;
exports.getLogger = getLogger;
exports.addAppender = addAppender;
exports.setLevel = setLevel;

function AggregateError(msg, inner, skipIfAlreadyAggregate) {
Expand All @@ -55,7 +20,7 @@ define(["exports"], function (exports) {
}

if (inner.stack) {
msg += "\n------------------------------------------------\ninner error: " + inner.stack;
msg += '\n------------------------------------------------\ninner error: ' + inner.stack;
}
}

Expand All @@ -67,21 +32,15 @@ define(["exports"], function (exports) {
return err;
}

/**
* Enum specifying the levels of the logger
*
* @property levels
* @type Enum
* @for export
*/
var levels = exports.levels = {
var levels = {
none: 0,
error: 1,
warn: 2,
info: 3,
debug: 4
};

exports.levels = levels;
var loggers = {},
logLevel = levels.none,
appenders = [],
Expand All @@ -106,31 +65,31 @@ define(["exports"], function (exports) {
return;
}

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

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

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

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

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

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

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

function connectLogger(logger) {
Expand All @@ -149,6 +108,7 @@ define(["exports"], function (exports) {

return logger;
}

function getLogger(id) {
return loggers[id] || (loggers[id] = createLogger(id));
}
Expand All @@ -167,91 +127,33 @@ define(["exports"], function (exports) {
logLevel = level;
}

/**
* The logger is essentially responsible for having log statements that appear during debugging but are squelched
* when using the build tools, depending on the log level that is set. The available levels are -
* 1. none
* 2. error
* 3. warn
* 4. info
* 5. debug
*
* You cannot instantiate the logger directly - you must use the getLogger method instead.
*
* @class Logger
* @constructor
*/

var Logger = exports.Logger = (function () {
var Logger = (function () {
function Logger(id, key) {
_classCallCheck(this, Logger);

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

this.id = id;
}

_prototypeProperties(Logger, null, {
debug: {

/**
* Logs a debug message.
*
* @method debug
* @param {string} message The message to log
*/

value: function debug() {},
writable: true,
configurable: true
},
info: {

/**
* Logs info.
*
* @method info
* @param {string} message The message to log
*/

value: function info() {},
writable: true,
configurable: true
},
warn: {

/**
* Logs a warning.
*
* @method warn
* @param {string} message The message to log
*/

value: function warn() {},
writable: true,
configurable: true
},
error: {

/**
* Logs an error.
*
* @method error
* @param {string} message The message to log
*/

value: function error() {},
writable: true,
configurable: true
}
});
_createClass(Logger, [{
key: 'debug',
value: function debug() {}
}, {
key: 'info',
value: function info() {}
}, {
key: 'warn',
value: function warn() {}
}, {
key: 'error',
value: function error() {}
}]);

return Logger;
})();

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Logger = Logger;
});
Loading

0 comments on commit 83c228c

Please sign in to comment.