diff --git a/bower.json b/bower.json index 8084702..f09c1a2 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-logging", - "version": "1.2.0", + "version": "1.3.0", "description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.", "keywords": [ "aurelia", diff --git a/dist/amd/aurelia-logging.js b/dist/amd/aurelia-logging.js index 84c1d9a..cd35bd8 100644 --- a/dist/amd/aurelia-logging.js +++ b/dist/amd/aurelia-logging.js @@ -6,6 +6,7 @@ define(['exports'], function (exports) { }); exports.getLogger = getLogger; exports.addAppender = addAppender; + exports.removeAppender = removeAppender; exports.setLevel = setLevel; exports.getLevel = getLevel; @@ -21,87 +22,54 @@ define(['exports'], function (exports) { var loggers = {}; var appenders = []; - var slice = Array.prototype.slice; - var loggerConstructionKey = {}; var globalDefaultLevel = logLevel.none; - function log(logger, level, args) { - var i = appenders.length; - var current = void 0; - - args = slice.call(args); - args.unshift(logger); - - while (i--) { - current = appenders[i]; - current[level].apply(current, args); - } - } - - function debug() { - if (this.level < 4) { - return; - } - - log(this, 'debug', arguments); - } - - function info() { - if (this.level < 3) { - return; - } - - log(this, 'info', arguments); - } - - function warn() { - if (this.level < 2) { - return; - } - - log(this, 'warn', arguments); + function appendArgs() { + return [this].concat(Array.prototype.slice.call(arguments)); } - function error() { - if (this.level < 1) { - return; - } + function logFactory(level) { + var threshold = logLevel[level]; + return function () { + if (this.level < threshold) { + return; + } - log(this, 'error', arguments); - } + var args = appendArgs.apply(this, arguments); + var i = appenders.length; + while (i--) { + var _appenders$i; - function connectLogger(logger) { - logger.debug = debug; - logger.info = info; - logger.warn = warn; - logger.error = error; + (_appenders$i = appenders[i])[level].apply(_appenders$i, args); + } + }; } - function createLogger(id) { - var logger = new Logger(id, loggerConstructionKey); - logger.setLevel(globalDefaultLevel); - - if (appenders.length) { - connectLogger(logger); - } - - return logger; + function connectLoggers() { + Object.assign(Logger.prototype, { + debug: logFactory('debug'), + info: logFactory('info'), + warn: logFactory('warn'), + error: logFactory('error') + }); } function getLogger(id) { - return loggers[id] || (loggers[id] = createLogger(id)); + return loggers[id] || new Logger(id); } function addAppender(appender) { - appenders.push(appender); - - if (appenders.length === 1) { - for (var key in loggers) { - connectLogger(loggers[key]); - } + if (appenders.push(appender) === 1) { + connectLoggers(); } } + function removeAppender(appender) { + appenders = appenders.filter(function (a) { + return a !== appender; + }); + } + function setLevel(level) { globalDefaultLevel = level; for (var key in loggers) { @@ -114,16 +82,17 @@ define(['exports'], function (exports) { } var Logger = exports.Logger = function () { - function Logger(id, key) { + function Logger(id) { - this.level = logLevel.none; - - if (key !== loggerConstructionKey) { - throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.'); + var cached = loggers[id]; + if (cached) { + return cached; } + loggers[id] = this; this.id = id; + this.level = globalDefaultLevel; } Logger.prototype.debug = function debug(message) {}; diff --git a/dist/aurelia-logging.d.ts b/dist/aurelia-logging.d.ts index aea017d..55f2dff 100644 --- a/dist/aurelia-logging.d.ts +++ b/dist/aurelia-logging.d.ts @@ -96,6 +96,12 @@ export declare function getLogger(id: string): Logger; */ export declare function addAppender(appender: Appender): void; +/** +* Removes an appender +* @param appender An appender that has been added previously. +*/ +export declare function removeAppender(appender: Appender): void; + /** * Sets the level of logging for ALL the application loggers. * @@ -128,7 +134,7 @@ export declare class Logger { /** * You cannot instantiate the logger directly - you must use the getLogger method instead. */ - constructor(id: string, key: Object); + constructor(id: string); /** * Logs a debug message. diff --git a/dist/aurelia-logging.js b/dist/aurelia-logging.js index 97933f4..c77d83d 100644 --- a/dist/aurelia-logging.js +++ b/dist/aurelia-logging.js @@ -38,71 +38,37 @@ export const logLevel: LogLevel = { let loggers = {}; let appenders = []; -let slice = Array.prototype.slice; -let loggerConstructionKey = {}; let globalDefaultLevel = logLevel.none; -function log(logger, level, args) { - let i = appenders.length; - let current; - - args = slice.call(args); - args.unshift(logger); - - while (i--) { - current = appenders[i]; - current[level].apply(current, args); - } -} - -function debug() { - if (this.level < 4) { - return; - } - - log(this, 'debug', arguments); -} - -function info() { - if (this.level < 3) { - return; - } - - log(this, 'info', arguments); -} - -function warn() { - if (this.level < 2) { - return; - } - - log(this, 'warn', arguments); +function appendArgs() { + return [this, ...arguments]; } -function error() { - if (this.level < 1) { - return; - } - - log(this, 'error', arguments); +function logFactory(level) { + const threshold = logLevel[level]; + return function() { + // In this function, this === logger + if (this.level < threshold) { + return; + } + // We don't want to disable optimizations (such as inlining) in this function + // so we do the arguments manipulation in another function. + // Note that Function#apply is very special for V8. + const args = appendArgs.apply(this, arguments); + let i = appenders.length; + while (i--) { + appenders[i][level](...args); + } + }; } -function connectLogger(logger) { - logger.debug = debug; - logger.info = info; - logger.warn = warn; - logger.error = error; -} - -function createLogger(id) { - let logger = new Logger(id, loggerConstructionKey); - logger.setLevel(globalDefaultLevel); - - if (appenders.length) { - connectLogger(logger); - } - - return logger; +function connectLoggers() { + Object.assign(Logger.prototype, { + debug: logFactory('debug'), + info: logFactory('info'), + warn: logFactory('warn'), + error: logFactory('error') + }); } /** @@ -112,7 +78,7 @@ function createLogger(id) { * @return The instance of the logger, or creates a new logger if none exists for that id. */ export function getLogger(id: string): Logger { - return loggers[id] || (loggers[id] = createLogger(id)); + return loggers[id] || new Logger(id); } /** @@ -158,15 +124,19 @@ interface Appender { * @param appender An appender instance to begin processing logs with. */ export function addAppender(appender: Appender): void { - appenders.push(appender); - - if (appenders.length === 1) { - for (let key in loggers) { - connectLogger(loggers[key]); - } + if (appenders.push(appender) === 1) { + connectLoggers(); } } +/** +* Removes an appender +* @param appender An appender that has been added previously. +*/ +export function removeAppender(appender: Appender): void { + appenders = appenders.filter(a => a !== appender); +} + /** * Sets the level of logging for ALL the application loggers. * @@ -200,17 +170,20 @@ export class Logger { /** * The logging severity level for this logger */ - level: number = logLevel.none; + level: number; /** * You cannot instantiate the logger directly - you must use the getLogger method instead. */ - constructor(id: string, key: Object) { - if (key !== loggerConstructionKey) { - throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.'); + constructor(id: string) { + let cached = loggers[id]; + if (cached) { + return cached; } + loggers[id] = this; this.id = id; + this.level = globalDefaultLevel; } /** diff --git a/dist/commonjs/aurelia-logging.js b/dist/commonjs/aurelia-logging.js index 88e82a8..b11fd33 100644 --- a/dist/commonjs/aurelia-logging.js +++ b/dist/commonjs/aurelia-logging.js @@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.getLogger = getLogger; exports.addAppender = addAppender; +exports.removeAppender = removeAppender; exports.setLevel = setLevel; exports.getLevel = getLevel; @@ -20,87 +21,54 @@ var logLevel = exports.logLevel = { var loggers = {}; var appenders = []; -var slice = Array.prototype.slice; -var loggerConstructionKey = {}; var globalDefaultLevel = logLevel.none; -function log(logger, level, args) { - var i = appenders.length; - var current = void 0; - - args = slice.call(args); - args.unshift(logger); - - while (i--) { - current = appenders[i]; - current[level].apply(current, args); - } -} - -function debug() { - if (this.level < 4) { - return; - } - - log(this, 'debug', arguments); -} - -function info() { - if (this.level < 3) { - return; - } - - log(this, 'info', arguments); -} - -function warn() { - if (this.level < 2) { - return; - } - - log(this, 'warn', arguments); +function appendArgs() { + return [this].concat(Array.prototype.slice.call(arguments)); } -function error() { - if (this.level < 1) { - return; - } +function logFactory(level) { + var threshold = logLevel[level]; + return function () { + if (this.level < threshold) { + return; + } - log(this, 'error', arguments); -} + var args = appendArgs.apply(this, arguments); + var i = appenders.length; + while (i--) { + var _appenders$i; -function connectLogger(logger) { - logger.debug = debug; - logger.info = info; - logger.warn = warn; - logger.error = error; + (_appenders$i = appenders[i])[level].apply(_appenders$i, args); + } + }; } -function createLogger(id) { - var logger = new Logger(id, loggerConstructionKey); - logger.setLevel(globalDefaultLevel); - - if (appenders.length) { - connectLogger(logger); - } - - return logger; +function connectLoggers() { + Object.assign(Logger.prototype, { + debug: logFactory('debug'), + info: logFactory('info'), + warn: logFactory('warn'), + error: logFactory('error') + }); } function getLogger(id) { - return loggers[id] || (loggers[id] = createLogger(id)); + return loggers[id] || new Logger(id); } function addAppender(appender) { - appenders.push(appender); - - if (appenders.length === 1) { - for (var key in loggers) { - connectLogger(loggers[key]); - } + if (appenders.push(appender) === 1) { + connectLoggers(); } } +function removeAppender(appender) { + appenders = appenders.filter(function (a) { + return a !== appender; + }); +} + function setLevel(level) { globalDefaultLevel = level; for (var key in loggers) { @@ -113,16 +81,17 @@ function getLevel() { } var Logger = exports.Logger = function () { - function Logger(id, key) { + function Logger(id) { - this.level = logLevel.none; - - if (key !== loggerConstructionKey) { - throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.'); + var cached = loggers[id]; + if (cached) { + return cached; } + loggers[id] = this; this.id = id; + this.level = globalDefaultLevel; } Logger.prototype.debug = function debug(message) {}; diff --git a/dist/es2015/aurelia-logging.js b/dist/es2015/aurelia-logging.js index 4029831..d67703f 100644 --- a/dist/es2015/aurelia-logging.js +++ b/dist/es2015/aurelia-logging.js @@ -9,87 +9,50 @@ export const logLevel = { let loggers = {}; let appenders = []; -let slice = Array.prototype.slice; -let loggerConstructionKey = {}; let globalDefaultLevel = logLevel.none; -function log(logger, level, args) { - let i = appenders.length; - let current; - - args = slice.call(args); - args.unshift(logger); - - while (i--) { - current = appenders[i]; - current[level].apply(current, args); - } -} - -function debug() { - if (this.level < 4) { - return; - } - - log(this, 'debug', arguments); -} - -function info() { - if (this.level < 3) { - return; - } - - log(this, 'info', arguments); -} - -function warn() { - if (this.level < 2) { - return; - } - - log(this, 'warn', arguments); +function appendArgs() { + return [this, ...arguments]; } -function error() { - if (this.level < 1) { - return; - } - - log(this, 'error', arguments); -} +function logFactory(level) { + const threshold = logLevel[level]; + return function () { + if (this.level < threshold) { + return; + } -function connectLogger(logger) { - logger.debug = debug; - logger.info = info; - logger.warn = warn; - logger.error = error; + const args = appendArgs.apply(this, arguments); + let i = appenders.length; + while (i--) { + appenders[i][level](...args); + } + }; } -function createLogger(id) { - let logger = new Logger(id, loggerConstructionKey); - logger.setLevel(globalDefaultLevel); - - if (appenders.length) { - connectLogger(logger); - } - - return logger; +function connectLoggers() { + Object.assign(Logger.prototype, { + debug: logFactory('debug'), + info: logFactory('info'), + warn: logFactory('warn'), + error: logFactory('error') + }); } export function getLogger(id) { - return loggers[id] || (loggers[id] = createLogger(id)); + return loggers[id] || new Logger(id); } export function addAppender(appender) { - appenders.push(appender); - - if (appenders.length === 1) { - for (let key in loggers) { - connectLogger(loggers[key]); - } + if (appenders.push(appender) === 1) { + connectLoggers(); } } +export function removeAppender(appender) { + appenders = appenders.filter(a => a !== appender); +} + export function setLevel(level) { globalDefaultLevel = level; for (let key in loggers) { @@ -102,14 +65,15 @@ export function getLevel() { } export let Logger = class Logger { - constructor(id, key) { - this.level = logLevel.none; - - if (key !== loggerConstructionKey) { - throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.'); + constructor(id) { + let cached = loggers[id]; + if (cached) { + return cached; } + loggers[id] = this; this.id = id; + this.level = globalDefaultLevel; } debug(message, ...rest) {} diff --git a/dist/native-modules/aurelia-logging.js b/dist/native-modules/aurelia-logging.js index 578ef77..17a3f95 100644 --- a/dist/native-modules/aurelia-logging.js +++ b/dist/native-modules/aurelia-logging.js @@ -10,87 +10,54 @@ export var logLevel = { var loggers = {}; var appenders = []; -var slice = Array.prototype.slice; -var loggerConstructionKey = {}; var globalDefaultLevel = logLevel.none; -function log(logger, level, args) { - var i = appenders.length; - var current = void 0; - - args = slice.call(args); - args.unshift(logger); - - while (i--) { - current = appenders[i]; - current[level].apply(current, args); - } -} - -function debug() { - if (this.level < 4) { - return; - } - - log(this, 'debug', arguments); -} - -function info() { - if (this.level < 3) { - return; - } - - log(this, 'info', arguments); -} - -function warn() { - if (this.level < 2) { - return; - } - - log(this, 'warn', arguments); +function appendArgs() { + return [this].concat(Array.prototype.slice.call(arguments)); } -function error() { - if (this.level < 1) { - return; - } +function logFactory(level) { + var threshold = logLevel[level]; + return function () { + if (this.level < threshold) { + return; + } - log(this, 'error', arguments); -} + var args = appendArgs.apply(this, arguments); + var i = appenders.length; + while (i--) { + var _appenders$i; -function connectLogger(logger) { - logger.debug = debug; - logger.info = info; - logger.warn = warn; - logger.error = error; + (_appenders$i = appenders[i])[level].apply(_appenders$i, args); + } + }; } -function createLogger(id) { - var logger = new Logger(id, loggerConstructionKey); - logger.setLevel(globalDefaultLevel); - - if (appenders.length) { - connectLogger(logger); - } - - return logger; +function connectLoggers() { + Object.assign(Logger.prototype, { + debug: logFactory('debug'), + info: logFactory('info'), + warn: logFactory('warn'), + error: logFactory('error') + }); } export function getLogger(id) { - return loggers[id] || (loggers[id] = createLogger(id)); + return loggers[id] || new Logger(id); } export function addAppender(appender) { - appenders.push(appender); - - if (appenders.length === 1) { - for (var key in loggers) { - connectLogger(loggers[key]); - } + if (appenders.push(appender) === 1) { + connectLoggers(); } } +export function removeAppender(appender) { + appenders = appenders.filter(function (a) { + return a !== appender; + }); +} + export function setLevel(level) { globalDefaultLevel = level; for (var key in loggers) { @@ -103,16 +70,17 @@ export function getLevel() { } export var Logger = function () { - function Logger(id, key) { + function Logger(id) { - this.level = logLevel.none; - - if (key !== loggerConstructionKey) { - throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.'); + var cached = loggers[id]; + if (cached) { + return cached; } + loggers[id] = this; this.id = id; + this.level = globalDefaultLevel; } Logger.prototype.debug = function debug(message) {}; diff --git a/dist/system/aurelia-logging.js b/dist/system/aurelia-logging.js index 5e8ac6f..7a7aa1c 100644 --- a/dist/system/aurelia-logging.js +++ b/dist/system/aurelia-logging.js @@ -3,91 +3,62 @@ System.register([], function (_export, _context) { "use strict"; - var logLevel, loggers, appenders, slice, loggerConstructionKey, globalDefaultLevel, Logger; + var logLevel, loggers, appenders, globalDefaultLevel, Logger; - function log(logger, level, args) { - var i = appenders.length; - var current = void 0; - - args = slice.call(args); - args.unshift(logger); - - while (i--) { - current = appenders[i]; - current[level].apply(current, args); - } - } - - function debug() { - if (this.level < 4) { - return; - } - - log(this, 'debug', arguments); - } - - function info() { - if (this.level < 3) { - return; - } - - log(this, 'info', arguments); - } - - function warn() { - if (this.level < 2) { - return; - } - - log(this, 'warn', arguments); + function appendArgs() { + return [this].concat(Array.prototype.slice.call(arguments)); } - function error() { - if (this.level < 1) { - return; - } + function logFactory(level) { + var threshold = logLevel[level]; + return function () { + if (this.level < threshold) { + return; + } - log(this, 'error', arguments); - } + var args = appendArgs.apply(this, arguments); + var i = appenders.length; + while (i--) { + var _appenders$i; - function connectLogger(logger) { - logger.debug = debug; - logger.info = info; - logger.warn = warn; - logger.error = error; + (_appenders$i = appenders[i])[level].apply(_appenders$i, args); + } + }; } - function createLogger(id) { - var logger = new Logger(id, loggerConstructionKey); - logger.setLevel(globalDefaultLevel); - - if (appenders.length) { - connectLogger(logger); - } - - return logger; + function connectLoggers() { + Object.assign(Logger.prototype, { + debug: logFactory('debug'), + info: logFactory('info'), + warn: logFactory('warn'), + error: logFactory('error') + }); } function getLogger(id) { - return loggers[id] || (loggers[id] = createLogger(id)); + return loggers[id] || new Logger(id); } _export('getLogger', getLogger); function addAppender(appender) { - appenders.push(appender); - - if (appenders.length === 1) { - for (var key in loggers) { - connectLogger(loggers[key]); - } + if (appenders.push(appender) === 1) { + connectLoggers(); } } _export('addAppender', addAppender); + function removeAppender(appender) { + appenders = appenders.filter(function (a) { + return a !== appender; + }); + } + + _export('removeAppender', removeAppender); + function setLevel(level) { globalDefaultLevel = level; for (var key in loggers) { @@ -118,21 +89,20 @@ System.register([], function (_export, _context) { loggers = {}; appenders = []; - slice = Array.prototype.slice; - loggerConstructionKey = {}; globalDefaultLevel = logLevel.none; _export('Logger', Logger = function () { - function Logger(id, key) { + function Logger(id) { - this.level = logLevel.none; - - if (key !== loggerConstructionKey) { - throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.'); + var cached = loggers[id]; + if (cached) { + return cached; } + loggers[id] = this; this.id = id; + this.level = globalDefaultLevel; } Logger.prototype.debug = function debug(message) {}; diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 8673035..e7498bc 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,8 @@ + +# [1.3.0](https://github.com/aurelia/logging/compare/1.2.0...v1.3.0) (2017-02-21) + + + # [1.2.0](https://github.com/aurelia/logging/compare/1.1.1...v1.2.0) (2016-12-03) diff --git a/doc/api.json b/doc/api.json index c003b9e..b7ec134 100644 --- a/doc/api.json +++ b/doc/api.json @@ -1 +1 @@ -{"name":"aurelia-logging","children":[{"id":25,"name":"Logger","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"A logger logs messages to a set of appenders, depending on the log level that is set."},"children":[{"id":28,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"You cannot instantiate the logger directly - you must use the getLogger method instead."},"signatures":[{"id":29,"name":"new Logger","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"You cannot instantiate the logger directly - you must use the getLogger method instead."},"parameters":[{"id":30,"name":"id","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}},{"id":31,"name":"key","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"reference","name":"Object"}}],"type":{"type":"reference","name":"Logger","id":25}}]},{"id":26,"name":"id","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The id that the logger was created with."},"type":{"type":"instrinct","name":"string"}},{"id":27,"name":"level","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The logging severity level for this logger"},"type":{"type":"instrinct","name":"number"}},{"id":32,"name":"debug","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":33,"name":"debug","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs a debug message."},"parameters":[{"id":34,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":35,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":44,"name":"error","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":45,"name":"error","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs an error."},"parameters":[{"id":46,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":47,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":36,"name":"info","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":37,"name":"info","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs info."},"parameters":[{"id":38,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":39,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":48,"name":"setLevel","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":49,"name":"setLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the level of logging for this logger instance"},"parameters":[{"id":50,"name":"level","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"Matches a value of logLevel specifying the level of logging.\n"},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":40,"name":"warn","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":41,"name":"warn","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs a warning."},"parameters":[{"id":42,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":43,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]}],"groups":[{"title":"Constructors","kind":512,"children":[28]},{"title":"Properties","kind":1024,"children":[26,27]},{"title":"Methods","kind":2048,"children":[32,44,36,48,40]}]},{"id":8,"name":"Appender","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Implemented by classes which wish to append log data to a target data store."},"children":[{"id":9,"name":"debug","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":10,"name":"debug","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends a debug log."},"parameters":[{"id":11,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":25}},{"id":12,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":21,"name":"error","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":22,"name":"error","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends an error log."},"parameters":[{"id":23,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":25}},{"id":24,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":13,"name":"info","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":14,"name":"info","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends an info log."},"parameters":[{"id":15,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":25}},{"id":16,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":17,"name":"warn","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":18,"name":"warn","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends a warning log."},"parameters":[{"id":19,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":25}},{"id":20,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]}],"groups":[{"title":"Methods","kind":2048,"children":[9,21,13,17]}]},{"id":2,"name":"LogLevel","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Specifies the available logging levels."},"children":[{"id":7,"name":"debug","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Log all messages."},"type":{"type":"instrinct","name":"number"}},{"id":4,"name":"error","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Log only error messages."},"type":{"type":"instrinct","name":"number"}},{"id":6,"name":"info","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Log informational messages or above."},"type":{"type":"instrinct","name":"number"}},{"id":3,"name":"none","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"No logging."},"type":{"type":"instrinct","name":"number"}},{"id":5,"name":"warn","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Log warnings messages or above."},"type":{"type":"instrinct","name":"number"}}],"groups":[{"title":"Properties","kind":1024,"children":[7,4,6,3,5]}]},{"id":51,"name":"logLevel","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Specifies the available logging levels."},"type":{"type":"reference","name":"LogLevel","id":2}},{"id":55,"name":"addAppender","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":56,"name":"addAppender","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an appender capable of processing logs and channeling them to an output."},"parameters":[{"id":57,"name":"appender","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"An appender instance to begin processing logs with.\n"},"type":{"type":"reference","name":"Appender","id":8}}],"type":{"type":"instrinct","name":"void"}}]},{"id":61,"name":"getLevel","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":62,"name":"getLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the level of logging of ALL the application loggers.","returns":"The logLevel value used in all loggers.\n"},"type":{"type":"instrinct","name":"number"}}]},{"id":52,"name":"getLogger","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":53,"name":"getLogger","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the instance of a logger associated with a particular id (or creates one if it doesn't already exist).","returns":"The instance of the logger, or creates a new logger if none exists for that id.\n"},"parameters":[{"id":54,"name":"id","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The id of the logger you wish to get an instance of."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Logger","id":25}}]},{"id":58,"name":"setLevel","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":59,"name":"setLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the level of logging for ALL the application loggers."},"parameters":[{"id":60,"name":"level","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"Matches a value of logLevel specifying the level of logging.\n"},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"instrinct","name":"void"}}]}],"groups":[{"title":"Classes","kind":128,"children":[25]},{"title":"Interfaces","kind":256,"children":[8,2]},{"title":"Variables","kind":32,"children":[51]},{"title":"Functions","kind":64,"children":[55,61,52,58]}]} \ No newline at end of file +{"name":"aurelia-logging","children":[{"id":25,"name":"Logger","kind":128,"kindString":"Class","flags":{"isExported":true},"comment":{"shortText":"A logger logs messages to a set of appenders, depending on the log level that is set."},"children":[{"id":28,"name":"constructor","kind":512,"kindString":"Constructor","flags":{"isExported":true},"comment":{"shortText":"You cannot instantiate the logger directly - you must use the getLogger method instead."},"signatures":[{"id":29,"name":"new Logger","kind":16384,"kindString":"Constructor signature","flags":{},"comment":{"shortText":"You cannot instantiate the logger directly - you must use the getLogger method instead."},"parameters":[{"id":30,"name":"id","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Logger","id":25}}]},{"id":26,"name":"id","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The id that the logger was created with."},"type":{"type":"instrinct","name":"string"}},{"id":27,"name":"level","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The logging severity level for this logger"},"type":{"type":"instrinct","name":"number"}},{"id":31,"name":"debug","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":32,"name":"debug","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs a debug message."},"parameters":[{"id":33,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":34,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":43,"name":"error","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":44,"name":"error","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs an error."},"parameters":[{"id":45,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":46,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":35,"name":"info","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":36,"name":"info","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs info."},"parameters":[{"id":37,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":38,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":47,"name":"setLevel","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":48,"name":"setLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the level of logging for this logger instance"},"parameters":[{"id":49,"name":"level","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"Matches a value of logLevel specifying the level of logging.\n"},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":39,"name":"warn","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":40,"name":"warn","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs a warning."},"parameters":[{"id":41,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":42,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]}],"groups":[{"title":"Constructors","kind":512,"children":[28]},{"title":"Properties","kind":1024,"children":[26,27]},{"title":"Methods","kind":2048,"children":[31,43,35,47,39]}]},{"id":8,"name":"Appender","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Implemented by classes which wish to append log data to a target data store."},"children":[{"id":9,"name":"debug","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":10,"name":"debug","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends a debug log."},"parameters":[{"id":11,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":25}},{"id":12,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":21,"name":"error","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":22,"name":"error","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends an error log."},"parameters":[{"id":23,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":25}},{"id":24,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":13,"name":"info","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":14,"name":"info","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends an info log."},"parameters":[{"id":15,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":25}},{"id":16,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":17,"name":"warn","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":18,"name":"warn","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends a warning log."},"parameters":[{"id":19,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":25}},{"id":20,"name":"rest","kind":32768,"kindString":"Parameter","flags":{"isRest":true},"comment":{"text":"The data to log.\n"},"type":{"type":"instrinct","isArray":true,"name":"any"}}],"type":{"type":"instrinct","name":"void"}}]}],"groups":[{"title":"Methods","kind":2048,"children":[9,21,13,17]}]},{"id":2,"name":"LogLevel","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Specifies the available logging levels."},"children":[{"id":7,"name":"debug","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Log all messages."},"type":{"type":"instrinct","name":"number"}},{"id":4,"name":"error","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Log only error messages."},"type":{"type":"instrinct","name":"number"}},{"id":6,"name":"info","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Log informational messages or above."},"type":{"type":"instrinct","name":"number"}},{"id":3,"name":"none","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"No logging."},"type":{"type":"instrinct","name":"number"}},{"id":5,"name":"warn","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"Log warnings messages or above."},"type":{"type":"instrinct","name":"number"}}],"groups":[{"title":"Properties","kind":1024,"children":[7,4,6,3,5]}]},{"id":50,"name":"logLevel","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Specifies the available logging levels."},"type":{"type":"reference","name":"LogLevel","id":2}},{"id":54,"name":"addAppender","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":55,"name":"addAppender","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds an appender capable of processing logs and channeling them to an output."},"parameters":[{"id":56,"name":"appender","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"An appender instance to begin processing logs with.\n"},"type":{"type":"reference","name":"Appender","id":8}}],"type":{"type":"instrinct","name":"void"}}]},{"id":63,"name":"getLevel","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":64,"name":"getLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the level of logging of ALL the application loggers.","returns":"The logLevel value used in all loggers.\n"},"type":{"type":"instrinct","name":"number"}}]},{"id":51,"name":"getLogger","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":52,"name":"getLogger","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets the instance of a logger associated with a particular id (or creates one if it doesn't already exist).","returns":"The instance of the logger, or creates a new logger if none exists for that id.\n"},"parameters":[{"id":53,"name":"id","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The id of the logger you wish to get an instance of."},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Logger","id":25}}]},{"id":57,"name":"removeAppender","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":58,"name":"removeAppender","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes an appender"},"parameters":[{"id":59,"name":"appender","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"An appender that has been added previously.\n"},"type":{"type":"reference","name":"Appender","id":8}}],"type":{"type":"instrinct","name":"void"}}]},{"id":60,"name":"setLevel","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":61,"name":"setLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the level of logging for ALL the application loggers."},"parameters":[{"id":62,"name":"level","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"Matches a value of logLevel specifying the level of logging.\n"},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"instrinct","name":"void"}}]}],"groups":[{"title":"Classes","kind":128,"children":[25]},{"title":"Interfaces","kind":256,"children":[8,2]},{"title":"Variables","kind":32,"children":[50]},{"title":"Functions","kind":64,"children":[54,63,51,57,60]}]} \ No newline at end of file diff --git a/package.json b/package.json index 6465151..f4d08b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-logging", - "version": "1.2.0", + "version": "1.3.0", "description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.", "keywords": [ "aurelia",