From 528e04439766ce192f8f520e34ad466716af8c23 Mon Sep 17 00:00:00 2001 From: Rob Eisenberg Date: Tue, 24 Mar 2015 21:15:39 -0400 Subject: [PATCH] chore(all): prepare release 0.2.6 --- README.md | 2 +- bower.json | 2 +- dist/amd/index.js | 36 +++++++++++++++++++++++++++++------- dist/commonjs/index.js | 36 +++++++++++++++++++++++++++++------- dist/es6/index.js | 29 ++++++++++++++++++++++++----- dist/system/index.js | 38 ++++++++++++++++++++++++++++++-------- doc/CHANGELOG.md | 8 ++++++++ doc/api.json | 2 +- package.json | 2 +- 9 files changed, 124 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 3b400a1..eff5084 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This library is part of the [Aurelia](http://www.aurelia.io/) platform and contains a minimal but effective logging mechanism with support for log levels and pluggable log appenders. -> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/). If you have questions, we invite you to join us on [our Gitter Channel](https://gitter.im/aurelia/discuss). +> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.durandal.io/). If you have questions, we invite you to join us on [![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge). ## Dependencies diff --git a/bower.json b/bower.json index 9f926fe..91f4289 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-logging", - "version": "0.2.5", + "version": "0.2.6", "description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.", "keywords": [ "aurelia", diff --git a/dist/amd/index.js b/dist/amd/index.js index 1088e6b..baa0103 100644 --- a/dist/amd/index.js +++ b/dist/amd/index.js @@ -5,6 +5,21 @@ define(["exports"], function (exports) { 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; + /** * Gets an instance of a logger by the Id used when creating. * @@ -32,16 +47,23 @@ define(["exports"], function (exports) { * @for export */ exports.setLevel = setLevel; - /** - * 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 - */ + + function AggregateError(msg, inner) { + if (inner && inner.stack) { + msg += "\n------------------------------------------------\ninner error: " + inner.stack; + } + + var err = new Error(msg); + if (inner) { + err.innerError = inner; + } + + return err; + } /** * Enum specifying the levels of the logger - * + * * @property levels * @type Enum * @for export diff --git a/dist/commonjs/index.js b/dist/commonjs/index.js index c83f376..c990c4b 100644 --- a/dist/commonjs/index.js +++ b/dist/commonjs/index.js @@ -4,6 +4,21 @@ var _prototypeProperties = function (child, staticProps, instanceProps) { if (st 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; + /** * Gets an instance of a logger by the Id used when creating. * @@ -31,16 +46,23 @@ exports.addAppender = addAppender; * @for export */ exports.setLevel = setLevel; -/** - * 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 - */ + +function AggregateError(msg, inner) { + if (inner && inner.stack) { + msg += "\n------------------------------------------------\ninner error: " + inner.stack; + } + + var err = new Error(msg); + if (inner) { + err.innerError = inner; + } + + return err; +} /** * Enum specifying the levels of the logger -* +* * @property levels * @type Enum * @for export diff --git a/dist/es6/index.js b/dist/es6/index.js index e28e0cf..8a4279d 100644 --- a/dist/es6/index.js +++ b/dist/es6/index.js @@ -5,9 +5,28 @@ * @module logging */ + /** + * Creates an instance of Error that aggregates and preserves an innerError. + * + * @class AggregateError + * @constructor + */ + export function AggregateError(msg, inner) { + if (inner && inner.stack) { + msg += `\n------------------------------------------------\ninner error: ${inner.stack}`; + } + + var err = new Error(msg); + if (inner) { + err.innerError = inner; + } + + return err; +} + /** * Enum specifying the levels of the logger - * + * * @property levels * @type Enum * @for export @@ -20,14 +39,14 @@ export var levels = { debug:4 }; -var loggers = {}, +var loggers = {}, logLevel = levels.none, appenders = [], slice = Array.prototype.slice, loggerConstructionKey = {}; function log(logger, level, args){ - var i = appenders.length, + var i = appenders.length, current; args = slice.call(args); @@ -82,7 +101,7 @@ function createLogger(id){ var logger = new Logger(id, loggerConstructionKey); if(appenders.length) { - connectLogger(logger); + connectLogger(logger); } return logger; @@ -182,4 +201,4 @@ export class Logger { * @param {string} message The message to log */ error(){} -} \ No newline at end of file +} diff --git a/dist/system/index.js b/dist/system/index.js index 392bb76..000d5c2 100644 --- a/dist/system/index.js +++ b/dist/system/index.js @@ -1,6 +1,22 @@ System.register([], function (_export) { var _prototypeProperties, _classCallCheck, levels, loggers, logLevel, appenders, slice, loggerConstructionKey, Logger; + /** + * 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 + */ + + _export("AggregateError", AggregateError); + /** * Gets an instance of a logger by the Id used when creating. * @@ -32,6 +48,19 @@ System.register([], function (_export) { _export("setLevel", setLevel); + function AggregateError(msg, inner) { + if (inner && inner.stack) { + msg += "\n------------------------------------------------\ninner error: " + inner.stack; + } + + var err = new Error(msg); + if (inner) { + err.innerError = inner; + } + + return err; + } + function log(logger, level, args) { var i = appenders.length, current; @@ -120,16 +149,9 @@ System.register([], function (_export) { _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 - */ - /** * Enum specifying the levels of the logger - * + * * @property levels * @type Enum * @for export diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 98dfd02..1408021 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,11 @@ +### 0.2.6 (2015-03-24) + + +#### Features + +* **all:** enable error aggregation with new AggregateError ([88073ddb](http://github.com/aurelia/logging/commit/88073ddb7bb3d8c4ec86fb37d42978ae8c1b369f)) + + ### 0.2.5 (2015-02-28) diff --git a/doc/api.json b/doc/api.json index 314a0ba..08e8214 100644 --- a/doc/api.json +++ b/doc/api.json @@ -1 +1 @@ -{"name":"logging","description":"This library is part of the Aurelia platform and contains a minimal but effective logging mechanism\nwith support for log levels and pluggable log appenders.","classes":[{"name":"Logger","file":"aurelia/logging/src/index.js","line":131,"description":"The logger is essentially responsible for having log statements that appear during debugging but are squelched\nwhen using the build tools, depending on the log level that is set. The available levels are -\n1. none\n2. error\n3. warn\n4. info\n5. debug\n\nYou cannot instantiate the logger directly - you must use the getLogger method instead.","is_constructor":1,"methods":[{"line":154,"description":"Logs a debug message.","name":"debug","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":162,"description":"Logs info.","name":"info","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":170,"description":"Logs a warning.","name":"warn","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":178,"description":"Logs an error.","name":"error","params":[{"name":"message","description":"The message to log","type":"String"}]}],"properties":[],"events":[]}],"methods":[{"file":"aurelia/logging/src/index.js","line":91,"description":"Gets an instance of a logger by the Id used when creating.","name":"getLogger","params":[{"name":"id","description":"The id of the logger you wish to get an instance of.","type":"String"}],"return":{"description":"The instance of the logger, or creates a new logger if none exists for that Id.","type":"Logger"}},{"file":"aurelia/logging/src/index.js","line":103,"description":"Adds an appender capable of processing logs and channeling them to an output.","name":"addAppender","params":[{"name":"appender","description":"An appender instance to begin processing logs with.","type":"Object"}]},{"file":"aurelia/logging/src/index.js","line":120,"description":"Sets the level of the logging for the application loggers","name":"setLevel","params":[{"name":"level","description":"Matches an enum specifying the level of logging.","type":"Number"}]}],"properties":[{"file":"aurelia/logging/src/index.js","line":8,"description":"Enum specifying the levels of the logger","name":"levels","type":"Enum"}],"events":[]} \ No newline at end of file +{"name":"logging","description":"This library is part of the Aurelia platform and contains a minimal but effective logging mechanism\nwith support for log levels and pluggable log appenders.","classes":[{"name":"AggregateError","file":"aurelia/logging/src/index.js","line":8,"description":"Creates an instance of Error that aggregates and preserves an innerError.","is_constructor":1,"methods":[],"properties":[],"events":[]},{"name":"Logger","file":"aurelia/logging/src/index.js","line":150,"description":"The logger is essentially responsible for having log statements that appear during debugging but are squelched\nwhen using the build tools, depending on the log level that is set. The available levels are -\n1. none\n2. error\n3. warn\n4. info\n5. debug\n\nYou cannot instantiate the logger directly - you must use the getLogger method instead.","is_constructor":1,"methods":[{"line":173,"description":"Logs a debug message.","name":"debug","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":181,"description":"Logs info.","name":"info","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":189,"description":"Logs a warning.","name":"warn","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":197,"description":"Logs an error.","name":"error","params":[{"name":"message","description":"The message to log","type":"String"}]}],"properties":[],"events":[]}],"methods":[{"file":"aurelia/logging/src/index.js","line":110,"description":"Gets an instance of a logger by the Id used when creating.","name":"getLogger","params":[{"name":"id","description":"The id of the logger you wish to get an instance of.","type":"String"}],"return":{"description":"The instance of the logger, or creates a new logger if none exists for that Id.","type":"Logger"}},{"file":"aurelia/logging/src/index.js","line":122,"description":"Adds an appender capable of processing logs and channeling them to an output.","name":"addAppender","params":[{"name":"appender","description":"An appender instance to begin processing logs with.","type":"Object"}]},{"file":"aurelia/logging/src/index.js","line":139,"description":"Sets the level of the logging for the application loggers","name":"setLevel","params":[{"name":"level","description":"Matches an enum specifying the level of logging.","type":"Number"}]}],"properties":[{"file":"aurelia/logging/src/index.js","line":27,"description":"Enum specifying the levels of the logger","name":"levels","type":"Enum"}],"events":[]} \ No newline at end of file diff --git a/package.json b/package.json index 53e5a55..4ef10ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-logging", - "version": "0.2.5", + "version": "0.2.6", "description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.", "keywords": [ "aurelia",