diff --git a/bower.json b/bower.json index 91f4289..746866c 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-logging", - "version": "0.2.6", + "version": "0.2.7", "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 baa0103..9d53034 100644 --- a/dist/amd/index.js +++ b/dist/amd/index.js @@ -48,9 +48,15 @@ define(["exports"], function (exports) { */ exports.setLevel = setLevel; - function AggregateError(msg, inner) { - if (inner && inner.stack) { - msg += "\n------------------------------------------------\ninner error: " + inner.stack; + function AggregateError(msg, inner, skipIfAlreadyAggregate) { + if (inner) { + if (inner.innerError && skipIfAlreadyAggregate) { + return inner; + } + + if (inner.stack) { + msg += "\n------------------------------------------------\ninner error: " + inner.stack; + } } var err = new Error(msg); diff --git a/dist/commonjs/index.js b/dist/commonjs/index.js index c990c4b..21522ad 100644 --- a/dist/commonjs/index.js +++ b/dist/commonjs/index.js @@ -47,9 +47,15 @@ exports.addAppender = addAppender; */ exports.setLevel = setLevel; -function AggregateError(msg, inner) { - if (inner && inner.stack) { - msg += "\n------------------------------------------------\ninner error: " + inner.stack; +function AggregateError(msg, inner, skipIfAlreadyAggregate) { + if (inner) { + if (inner.innerError && skipIfAlreadyAggregate) { + return inner; + } + + if (inner.stack) { + msg += "\n------------------------------------------------\ninner error: " + inner.stack; + } } var err = new Error(msg); diff --git a/dist/es6/index.js b/dist/es6/index.js index 8a4279d..88c76ba 100644 --- a/dist/es6/index.js +++ b/dist/es6/index.js @@ -11,9 +11,15 @@ * @class AggregateError * @constructor */ - export function AggregateError(msg, inner) { - if (inner && inner.stack) { - msg += `\n------------------------------------------------\ninner error: ${inner.stack}`; + export function AggregateError(msg, inner, skipIfAlreadyAggregate) { + if(inner){ + if(inner.innerError && skipIfAlreadyAggregate){ + return inner; + } + + if(inner.stack) { + msg += `\n------------------------------------------------\ninner error: ${inner.stack}`; + } } var err = new Error(msg); diff --git a/dist/system/index.js b/dist/system/index.js index 000d5c2..50ea8af 100644 --- a/dist/system/index.js +++ b/dist/system/index.js @@ -48,9 +48,15 @@ System.register([], function (_export) { _export("setLevel", setLevel); - function AggregateError(msg, inner) { - if (inner && inner.stack) { - msg += "\n------------------------------------------------\ninner error: " + inner.stack; + function AggregateError(msg, inner, skipIfAlreadyAggregate) { + if (inner) { + if (inner.innerError && skipIfAlreadyAggregate) { + return inner; + } + + if (inner.stack) { + msg += "\n------------------------------------------------\ninner error: " + inner.stack; + } } var err = new Error(msg); diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 1408021..9661988 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,11 @@ +### 0.2.7 (2015-03-27) + + +#### Features + +* **AggregateError:** add ability to skip wrap if inner already exists ([98da4c32](http://github.com/aurelia/logging/commit/98da4c32c92ae12c654f3b3c827d48516970f174)) + + ### 0.2.6 (2015-03-24) diff --git a/doc/api.json b/doc/api.json index 08e8214..2a2e80e 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":"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 +{"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":156,"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":179,"description":"Logs a debug message.","name":"debug","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":187,"description":"Logs info.","name":"info","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":195,"description":"Logs a warning.","name":"warn","params":[{"name":"message","description":"The message to log","type":"String"}]},{"line":203,"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":116,"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":128,"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":145,"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":33,"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 4ef10ee..4c81512 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-logging", - "version": "0.2.6", + "version": "0.2.7", "description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.", "keywords": [ "aurelia",