Skip to content

Commit

Permalink
chore(all): prepare release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Oct 14, 2016
1 parent c8fd756 commit e1a7856
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 42 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": "1.0.0",
"version": "1.1.0",
"description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.",
"keywords": [
"aurelia",
Expand Down
19 changes: 13 additions & 6 deletions dist/amd/aurelia-logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ define(['exports'], function (exports) {
};

var loggers = {};
var currentLevel = logLevel.none;
var appenders = [];
var slice = Array.prototype.slice;
var loggerConstructionKey = {};
Expand All @@ -38,31 +37,31 @@ define(['exports'], function (exports) {
}

function debug() {
if (currentLevel < 4) {
if (this.level < 4) {
return;
}

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

function info() {
if (currentLevel < 3) {
if (this.level < 3) {
return;
}

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

function warn() {
if (currentLevel < 2) {
if (this.level < 2) {
return;
}

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

function error() {
if (currentLevel < 1) {
if (this.level < 1) {
return;
}

Expand Down Expand Up @@ -101,13 +100,17 @@ define(['exports'], function (exports) {
}

function setLevel(level) {
currentLevel = level;
for (var key in loggers) {
loggers[key].setLevel(level);
}
}

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


this.level = logLevel.none;

if (key !== loggerConstructionKey) {
throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.');
}
Expand All @@ -123,6 +126,10 @@ define(['exports'], function (exports) {

Logger.prototype.error = function error(message) {};

Logger.prototype.setLevel = function setLevel(level) {
this.level = level;
};

return Logger;
}();
});
14 changes: 13 additions & 1 deletion dist/aurelia-logging.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export declare function getLogger(id: string): Logger;
export declare function addAppender(appender: Appender): void;

/**
* Sets the level of logging for the application loggers.
* Sets the level of logging for ALL the application loggers.
*
* @param level Matches a value of logLevel specifying the level of logging.
*/
Expand All @@ -113,6 +113,11 @@ export declare class Logger {
*/
id: string;

/**
* The logging severity level for this logger
*/
level: number;

/**
* You cannot instantiate the logger directly - you must use the getLogger method instead.
*/
Expand Down Expand Up @@ -149,4 +154,11 @@ export declare class Logger {
* @param rest The data to log.
*/
error(message: string, ...rest: any[]): void;

/**
* Sets the level of logging this logger
*
* @param level Matches a value of logLevel specifying the level of logging.
*/
setLevel(level: LogLevel): void;
}
29 changes: 22 additions & 7 deletions dist/aurelia-logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export const logLevel: LogLevel = {
};

let loggers = {};
let currentLevel = logLevel.none;
let appenders = [];
let slice = Array.prototype.slice;
let loggerConstructionKey = {};
Expand All @@ -56,31 +55,31 @@ function log(logger, level, args) {
}

function debug() {
if (currentLevel < 4) {
if (this.level < 4) {
return;
}

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

function info() {
if (currentLevel < 3) {
if (this.level < 3) {
return;
}

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

function warn() {
if (currentLevel < 2) {
if (this.level < 2) {
return;
}

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

function error() {
if (currentLevel < 1) {
if (this.level < 1) {
return;
}

Expand Down Expand Up @@ -167,12 +166,14 @@ export function addAppender(appender: Appender): void {
}

/**
* Sets the level of logging for the application loggers.
* Sets the level of logging for ALL the application loggers.
*
* @param level Matches a value of logLevel specifying the level of logging.
*/
export function setLevel(level: number): void {
currentLevel = level;
for (let key in loggers) {
loggers[key].setLevel(level);
}
}

/**
Expand All @@ -184,6 +185,11 @@ export class Logger {
*/
id: string;

/**
* The logging severity level for this logger
*/
level: number = logLevel.none;

/**
* You cannot instantiate the logger directly - you must use the getLogger method instead.
*/
Expand Down Expand Up @@ -226,4 +232,13 @@ export class Logger {
* @param rest The data to log.
*/
error(message: string, ...rest: any[]): void {}

/**
* Sets the level of logging this logger
*
* @param level Matches a value of logLevel specifying the level of logging.
*/
setLevel(level: LogLevel): void {
this.level = level;
}
}
19 changes: 13 additions & 6 deletions dist/commonjs/aurelia-logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ var logLevel = exports.logLevel = {
};

var loggers = {};
var currentLevel = logLevel.none;
var appenders = [];
var slice = Array.prototype.slice;
var loggerConstructionKey = {};
Expand All @@ -37,31 +36,31 @@ function log(logger, level, args) {
}

function debug() {
if (currentLevel < 4) {
if (this.level < 4) {
return;
}

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

function info() {
if (currentLevel < 3) {
if (this.level < 3) {
return;
}

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

function warn() {
if (currentLevel < 2) {
if (this.level < 2) {
return;
}

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

function error() {
if (currentLevel < 1) {
if (this.level < 1) {
return;
}

Expand Down Expand Up @@ -100,13 +99,17 @@ function addAppender(appender) {
}

function setLevel(level) {
currentLevel = level;
for (var key in loggers) {
loggers[key].setLevel(level);
}
}

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


this.level = logLevel.none;

if (key !== loggerConstructionKey) {
throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.');
}
Expand All @@ -122,5 +125,9 @@ var Logger = exports.Logger = function () {

Logger.prototype.error = function error(message) {};

Logger.prototype.setLevel = function setLevel(level) {
this.level = level;
};

return Logger;
}();
19 changes: 13 additions & 6 deletions dist/es2015/aurelia-logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const logLevel = {
};

let loggers = {};
let currentLevel = logLevel.none;
let appenders = [];
let slice = Array.prototype.slice;
let loggerConstructionKey = {};
Expand All @@ -27,31 +26,31 @@ function log(logger, level, args) {
}

function debug() {
if (currentLevel < 4) {
if (this.level < 4) {
return;
}

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

function info() {
if (currentLevel < 3) {
if (this.level < 3) {
return;
}

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

function warn() {
if (currentLevel < 2) {
if (this.level < 2) {
return;
}

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

function error() {
if (currentLevel < 1) {
if (this.level < 1) {
return;
}

Expand Down Expand Up @@ -90,11 +89,15 @@ export function addAppender(appender) {
}

export function setLevel(level) {
currentLevel = level;
for (let key in loggers) {
loggers[key].setLevel(level);
}
}

export let Logger = class Logger {
constructor(id, key) {
this.level = logLevel.none;

if (key !== loggerConstructionKey) {
throw new Error('Cannot instantiate "Logger". Use "getLogger" instead.');
}
Expand All @@ -109,4 +112,8 @@ export let Logger = class Logger {
warn(message, ...rest) {}

error(message, ...rest) {}

setLevel(level) {
this.level = level;
}
};
Loading

0 comments on commit e1a7856

Please sign in to comment.