Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aurelia-logging

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aurelia-logging - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

test/custom-levels.spec.js

2

bower.json
{
"name": "aurelia-logging",
"version": "1.3.1",
"version": "1.4.0",
"description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -10,2 +10,6 @@ define(['exports'], function (exports) {

exports.removeAppender = removeAppender;
exports.getAppenders = getAppenders;
exports.clearAppenders = clearAppenders;
exports.addCustomLevel = addCustomLevel;
exports.removeCustomLevel = removeCustomLevel;
exports.setLevel = setLevel;

@@ -18,6 +22,6 @@ exports.getLevel = getLevel;

none: 0,
error: 1,
warn: 2,
info: 3,
debug: 4
error: 10,
warn: 20,
info: 30,
debug: 40
};

@@ -29,2 +33,9 @@

var standardLevels = ['none', 'error', 'warn', 'info', 'debug'];
function isStandardLevel(level) {
return standardLevels.filter(function (l) {
return l === level;
}).length > 0;
}
function appendArgs() {

@@ -51,10 +62,42 @@ return [this].concat(Array.prototype.slice.call(arguments));

function logFactoryCustom(level) {
var threshold = logLevel[level];
return function () {
if (this.level < threshold) {
return;
}
var args = appendArgs.apply(this, arguments);
var i = appenders.length;
while (i--) {
var appender = appenders[i];
if (appender[level] !== undefined) {
appender[level].apply(appender, args);
}
}
};
}
function connectLoggers() {
var proto = Logger.prototype;
proto.debug = logFactory('debug');
proto.info = logFactory('info');
proto.warn = logFactory('warn');
proto.error = logFactory('error');
for (var _level in logLevel) {
if (isStandardLevel(_level)) {
if (_level !== 'none') {
proto[_level] = logFactory(_level);
}
} else {
proto[_level] = logFactoryCustom(_level);
}
}
}
function disconnectLoggers() {
var proto = Logger.prototype;
for (var _level2 in logLevel) {
if (_level2 !== 'none') {
proto[_level2] = function () {};
}
}
}
function getLogger(id) {

@@ -76,2 +119,42 @@ return loggers[id] || new Logger(id);

function getAppenders() {
return [].concat(appenders);
}
function clearAppenders() {
appenders = [];
disconnectLoggers();
}
function addCustomLevel(name, value) {
if (logLevel[name] !== undefined) {
throw Error('Log level "' + name + '" already exists.');
}
if (isNaN(value)) {
throw Error('Value must be a number.');
}
logLevel[name] = value;
if (appenders.length > 0) {
connectLoggers();
} else {
Logger.prototype[name] = function () {};
}
}
function removeCustomLevel(name) {
if (logLevel[name] === undefined) {
return;
}
if (isStandardLevel(name)) {
throw Error('Built-in log level "' + name + '" cannot be removed.');
}
delete logLevel[name];
delete Logger.prototype[name];
}
function setLevel(level) {

@@ -78,0 +161,0 @@ globalDefaultLevel = level;

@@ -31,2 +31,7 @@

debug: number;
/**
* Additional log levels defined at runtime.
*/
[level: string]: number;
}

@@ -101,3 +106,3 @@

/**
* Removes an appender
* Removes an appender.
* @param appender An appender that has been added previously.

@@ -108,2 +113,27 @@ */

/**
* Gets an array of all appenders.
*/
export declare function getAppenders(): any;
/**
* Removes all appenders.
*/
export declare function clearAppenders(): void;
/**
* Adds a custom log level that will be added as an additional method to Logger.
* Logger will call the corresponding method on any appenders that support it.
*
* @param name The name for the new log level.
* @param value The numeric severity value for the level (higher is more severe).
*/
export declare function addCustomLevel(name: string, value: number): void;
/**
* Removes a custom log level.
* @param name The name of a custom log level that has been added previously.
*/
export declare function removeCustomLevel(name: string): void;
/**
* Sets the level of logging for ALL the application loggers.

@@ -110,0 +140,0 @@ *

@@ -25,3 +25,8 @@

*/
debug: number
debug: number,
/**
* Additional log levels defined at runtime.
*/
[level: string]: number
}

@@ -34,6 +39,6 @@

none: 0,
error: 1,
warn: 2,
info: 3,
debug: 4
error: 10,
warn: 20,
info: 30,
debug: 40
};

@@ -45,2 +50,7 @@

const standardLevels = ['none', 'error', 'warn', 'info', 'debug'];
function isStandardLevel(level: string) {
return standardLevels.filter(l => l === level).length > 0;
}
function appendArgs() {

@@ -68,10 +78,47 @@ return [this, ...arguments];

function logFactoryCustom(level) {
//This function is the same as logFactory() except that it checks that the method
//is defined on the appender.
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--) {
const appender = appenders[i];
if (appender[level] !== undefined) {
appender[level](...args);
}
}
};
}
function connectLoggers() {
let proto = Logger.prototype;
proto.debug = logFactory('debug');
proto.info = logFactory('info');
proto.warn = logFactory('warn');
proto.error = logFactory('error');
for (let level in logLevel) {
if (isStandardLevel(level)) {
if (level !== 'none') {
proto[level] = logFactory(level);
}
} else {
proto[level] = logFactoryCustom(level);
}
}
}
function disconnectLoggers() {
let proto = Logger.prototype;
for (let level in logLevel) {
if (level !== 'none') {
proto[level] = function() { };
}
}
}
/**

@@ -91,2 +138,3 @@ * Gets the instance of a logger associated with a particular id (or creates one if it doesn't already exist).

interface Appender {
/**

@@ -137,3 +185,3 @@ * Appends a debug log.

/**
* Removes an appender
* Removes an appender.
* @param appender An appender that has been added previously.

@@ -146,2 +194,61 @@ */

/**
* Gets an array of all appenders.
*/
export function getAppenders() {
return [...appenders];
}
/**
* Removes all appenders.
*/
export function clearAppenders(): void {
appenders = [];
disconnectLoggers();
}
/**
* Adds a custom log level that will be added as an additional method to Logger.
* Logger will call the corresponding method on any appenders that support it.
*
* @param name The name for the new log level.
* @param value The numeric severity value for the level (higher is more severe).
*/
export function addCustomLevel(name: string, value: number): void {
if (logLevel[name] !== undefined) {
throw Error(`Log level "${name}" already exists.`);
}
if (isNaN(value)) {
throw Error('Value must be a number.');
}
logLevel[name] = value;
if (appenders.length > 0) {
//Reinitialize the Logger prototype with the new method.
connectLoggers();
} else {
//Add the custom level as a noop by default.
Logger.prototype[name] = function() { };
}
}
/**
* Removes a custom log level.
* @param name The name of a custom log level that has been added previously.
*/
export function removeCustomLevel(name: string): void {
if (logLevel[name] === undefined) {
return;
}
if (isStandardLevel(name)) {
throw Error(`Built-in log level "${name}" cannot be removed.`);
}
delete logLevel[name];
delete Logger.prototype[name];
}
/**
* Sets the level of logging for ALL the application loggers.

@@ -148,0 +255,0 @@ *

@@ -9,2 +9,6 @@ 'use strict';

exports.removeAppender = removeAppender;
exports.getAppenders = getAppenders;
exports.clearAppenders = clearAppenders;
exports.addCustomLevel = addCustomLevel;
exports.removeCustomLevel = removeCustomLevel;
exports.setLevel = setLevel;

@@ -17,6 +21,6 @@ exports.getLevel = getLevel;

none: 0,
error: 1,
warn: 2,
info: 3,
debug: 4
error: 10,
warn: 20,
info: 30,
debug: 40
};

@@ -28,2 +32,9 @@

var standardLevels = ['none', 'error', 'warn', 'info', 'debug'];
function isStandardLevel(level) {
return standardLevels.filter(function (l) {
return l === level;
}).length > 0;
}
function appendArgs() {

@@ -50,10 +61,42 @@ return [this].concat(Array.prototype.slice.call(arguments));

function logFactoryCustom(level) {
var threshold = logLevel[level];
return function () {
if (this.level < threshold) {
return;
}
var args = appendArgs.apply(this, arguments);
var i = appenders.length;
while (i--) {
var appender = appenders[i];
if (appender[level] !== undefined) {
appender[level].apply(appender, args);
}
}
};
}
function connectLoggers() {
var proto = Logger.prototype;
proto.debug = logFactory('debug');
proto.info = logFactory('info');
proto.warn = logFactory('warn');
proto.error = logFactory('error');
for (var _level in logLevel) {
if (isStandardLevel(_level)) {
if (_level !== 'none') {
proto[_level] = logFactory(_level);
}
} else {
proto[_level] = logFactoryCustom(_level);
}
}
}
function disconnectLoggers() {
var proto = Logger.prototype;
for (var _level2 in logLevel) {
if (_level2 !== 'none') {
proto[_level2] = function () {};
}
}
}
function getLogger(id) {

@@ -75,2 +118,42 @@ return loggers[id] || new Logger(id);

function getAppenders() {
return [].concat(appenders);
}
function clearAppenders() {
appenders = [];
disconnectLoggers();
}
function addCustomLevel(name, value) {
if (logLevel[name] !== undefined) {
throw Error('Log level "' + name + '" already exists.');
}
if (isNaN(value)) {
throw Error('Value must be a number.');
}
logLevel[name] = value;
if (appenders.length > 0) {
connectLoggers();
} else {
Logger.prototype[name] = function () {};
}
}
function removeCustomLevel(name) {
if (logLevel[name] === undefined) {
return;
}
if (isStandardLevel(name)) {
throw Error('Built-in log level "' + name + '" cannot be removed.');
}
delete logLevel[name];
delete Logger.prototype[name];
}
function setLevel(level) {

@@ -77,0 +160,0 @@ globalDefaultLevel = level;

export const logLevel = {
none: 0,
error: 1,
warn: 2,
info: 3,
debug: 4
error: 10,
warn: 20,
info: 30,
debug: 40
};

@@ -14,2 +14,7 @@

const standardLevels = ['none', 'error', 'warn', 'info', 'debug'];
function isStandardLevel(level) {
return standardLevels.filter(l => l === level).length > 0;
}
function appendArgs() {

@@ -34,10 +39,42 @@ return [this, ...arguments];

function logFactoryCustom(level) {
const threshold = logLevel[level];
return function () {
if (this.level < threshold) {
return;
}
const args = appendArgs.apply(this, arguments);
let i = appenders.length;
while (i--) {
const appender = appenders[i];
if (appender[level] !== undefined) {
appender[level](...args);
}
}
};
}
function connectLoggers() {
let proto = Logger.prototype;
proto.debug = logFactory('debug');
proto.info = logFactory('info');
proto.warn = logFactory('warn');
proto.error = logFactory('error');
for (let level in logLevel) {
if (isStandardLevel(level)) {
if (level !== 'none') {
proto[level] = logFactory(level);
}
} else {
proto[level] = logFactoryCustom(level);
}
}
}
function disconnectLoggers() {
let proto = Logger.prototype;
for (let level in logLevel) {
if (level !== 'none') {
proto[level] = function () {};
}
}
}
export function getLogger(id) {

@@ -57,2 +94,42 @@ return loggers[id] || new Logger(id);

export function getAppenders() {
return [...appenders];
}
export function clearAppenders() {
appenders = [];
disconnectLoggers();
}
export function addCustomLevel(name, value) {
if (logLevel[name] !== undefined) {
throw Error(`Log level "${ name }" already exists.`);
}
if (isNaN(value)) {
throw Error('Value must be a number.');
}
logLevel[name] = value;
if (appenders.length > 0) {
connectLoggers();
} else {
Logger.prototype[name] = function () {};
}
}
export function removeCustomLevel(name) {
if (logLevel[name] === undefined) {
return;
}
if (isStandardLevel(name)) {
throw Error(`Built-in log level "${ name }" cannot be removed.`);
}
delete logLevel[name];
delete Logger.prototype[name];
}
export function setLevel(level) {

@@ -59,0 +136,0 @@ globalDefaultLevel = level;

@@ -5,6 +5,6 @@

none: 0,
error: 1,
warn: 2,
info: 3,
debug: 4
error: 10,
warn: 20,
info: 30,
debug: 40
};

@@ -16,2 +16,9 @@

var standardLevels = ['none', 'error', 'warn', 'info', 'debug'];
function isStandardLevel(level) {
return standardLevels.filter(function (l) {
return l === level;
}).length > 0;
}
function appendArgs() {

@@ -38,10 +45,42 @@ return [this].concat(Array.prototype.slice.call(arguments));

function logFactoryCustom(level) {
var threshold = logLevel[level];
return function () {
if (this.level < threshold) {
return;
}
var args = appendArgs.apply(this, arguments);
var i = appenders.length;
while (i--) {
var appender = appenders[i];
if (appender[level] !== undefined) {
appender[level].apply(appender, args);
}
}
};
}
function connectLoggers() {
var proto = Logger.prototype;
proto.debug = logFactory('debug');
proto.info = logFactory('info');
proto.warn = logFactory('warn');
proto.error = logFactory('error');
for (var _level in logLevel) {
if (isStandardLevel(_level)) {
if (_level !== 'none') {
proto[_level] = logFactory(_level);
}
} else {
proto[_level] = logFactoryCustom(_level);
}
}
}
function disconnectLoggers() {
var proto = Logger.prototype;
for (var _level2 in logLevel) {
if (_level2 !== 'none') {
proto[_level2] = function () {};
}
}
}
export function getLogger(id) {

@@ -63,2 +102,42 @@ return loggers[id] || new Logger(id);

export function getAppenders() {
return [].concat(appenders);
}
export function clearAppenders() {
appenders = [];
disconnectLoggers();
}
export function addCustomLevel(name, value) {
if (logLevel[name] !== undefined) {
throw Error('Log level "' + name + '" already exists.');
}
if (isNaN(value)) {
throw Error('Value must be a number.');
}
logLevel[name] = value;
if (appenders.length > 0) {
connectLoggers();
} else {
Logger.prototype[name] = function () {};
}
}
export function removeCustomLevel(name) {
if (logLevel[name] === undefined) {
return;
}
if (isStandardLevel(name)) {
throw Error('Built-in log level "' + name + '" cannot be removed.');
}
delete logLevel[name];
delete Logger.prototype[name];
}
export function setLevel(level) {

@@ -65,0 +144,0 @@ globalDefaultLevel = level;

@@ -6,6 +6,12 @@ 'use strict';

var logLevel, loggers, appenders, globalDefaultLevel, Logger;
var logLevel, loggers, appenders, globalDefaultLevel, standardLevels, Logger;
function isStandardLevel(level) {
return standardLevels.filter(function (l) {
return l === level;
}).length > 0;
}
function appendArgs() {

@@ -32,10 +38,42 @@ return [this].concat(Array.prototype.slice.call(arguments));

function logFactoryCustom(level) {
var threshold = logLevel[level];
return function () {
if (this.level < threshold) {
return;
}
var args = appendArgs.apply(this, arguments);
var i = appenders.length;
while (i--) {
var appender = appenders[i];
if (appender[level] !== undefined) {
appender[level].apply(appender, args);
}
}
};
}
function connectLoggers() {
var proto = Logger.prototype;
proto.debug = logFactory('debug');
proto.info = logFactory('info');
proto.warn = logFactory('warn');
proto.error = logFactory('error');
for (var _level in logLevel) {
if (isStandardLevel(_level)) {
if (_level !== 'none') {
proto[_level] = logFactory(_level);
}
} else {
proto[_level] = logFactoryCustom(_level);
}
}
}
function disconnectLoggers() {
var proto = Logger.prototype;
for (var _level2 in logLevel) {
if (_level2 !== 'none') {
proto[_level2] = function () {};
}
}
}
function getLogger(id) {

@@ -63,2 +101,50 @@ return loggers[id] || new Logger(id);

function getAppenders() {
return [].concat(appenders);
}
_export('getAppenders', getAppenders);
function clearAppenders() {
appenders = [];
disconnectLoggers();
}
_export('clearAppenders', clearAppenders);
function addCustomLevel(name, value) {
if (logLevel[name] !== undefined) {
throw Error('Log level "' + name + '" already exists.');
}
if (isNaN(value)) {
throw Error('Value must be a number.');
}
logLevel[name] = value;
if (appenders.length > 0) {
connectLoggers();
} else {
Logger.prototype[name] = function () {};
}
}
_export('addCustomLevel', addCustomLevel);
function removeCustomLevel(name) {
if (logLevel[name] === undefined) {
return;
}
if (isStandardLevel(name)) {
throw Error('Built-in log level "' + name + '" cannot be removed.');
}
delete logLevel[name];
delete Logger.prototype[name];
}
_export('removeCustomLevel', removeCustomLevel);
function setLevel(level) {

@@ -84,6 +170,6 @@ globalDefaultLevel = level;

none: 0,
error: 1,
warn: 2,
info: 3,
debug: 4
error: 10,
warn: 20,
info: 30,
debug: 40
});

@@ -96,2 +182,3 @@

globalDefaultLevel = logLevel.none;
standardLevels = ['none', 'error', 'warn', 'info', 'debug'];

@@ -98,0 +185,0 @@ _export('Logger', Logger = function () {

@@ -1,1 +0,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"}}],"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]}]}
{"name":"aurelia-logging","children":[{"id":27,"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":30,"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":31,"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":32,"name":"id","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"reference","name":"Logger","id":27}}]},{"id":28,"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":29,"name":"level","kind":1024,"kindString":"Property","flags":{"isExported":true},"comment":{"shortText":"The logging severity level for this logger"},"type":{"type":"instrinct","name":"number"}},{"id":33,"name":"debug","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":34,"name":"debug","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs a debug message."},"parameters":[{"id":35,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":36,"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":45,"name":"error","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":46,"name":"error","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs an error."},"parameters":[{"id":47,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":48,"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":37,"name":"info","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":38,"name":"info","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs info."},"parameters":[{"id":39,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":40,"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":49,"name":"setLevel","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":50,"name":"setLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the level of logging for this logger instance"},"parameters":[{"id":51,"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":41,"name":"warn","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":42,"name":"warn","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Logs a warning."},"parameters":[{"id":43,"name":"message","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The message to log."},"type":{"type":"instrinct","name":"string"}},{"id":44,"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":[30]},{"title":"Properties","kind":1024,"children":[28,29]},{"title":"Methods","kind":2048,"children":[33,45,37,49,41]}]},{"id":10,"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":11,"name":"debug","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":12,"name":"debug","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends a debug log."},"parameters":[{"id":13,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":27}},{"id":14,"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":23,"name":"error","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":24,"name":"error","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends an error log."},"parameters":[{"id":25,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":27}},{"id":26,"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":15,"name":"info","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":16,"name":"info","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends an info log."},"parameters":[{"id":17,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":27}},{"id":18,"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":19,"name":"warn","kind":2048,"kindString":"Method","flags":{"isExported":true},"signatures":[{"id":20,"name":"warn","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Appends a warning log."},"parameters":[{"id":21,"name":"logger","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The source logger."},"type":{"type":"reference","name":"Logger","id":27}},{"id":22,"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":[11,23,15,19]}]},{"id":2,"name":"LogLevel","kind":256,"kindString":"Interface","flags":{"isExported":true},"comment":{"shortText":"Specifies the available logging levels."},"indexSignature":[{"id":8,"name":"__index","kind":8192,"kindString":"Index signature","flags":{},"comment":{"shortText":"Additional log levels defined at runtime."},"parameters":[{"id":9,"name":"level","kind":32768,"kindString":"Parameter","flags":{},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"number"}}],"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":52,"name":"logLevel","kind":32,"kindString":"Variable","flags":{"isExported":true},"comment":{"shortText":"Specifies the available logging levels."},"type":{"type":"reference","name":"LogLevel","id":2}},{"id":56,"name":"addAppender","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":57,"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":58,"name":"appender","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"An appender instance to begin processing logs with.\n"},"type":{"type":"reference","name":"Appender","id":10}}],"type":{"type":"instrinct","name":"void"}}]},{"id":66,"name":"addCustomLevel","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":67,"name":"addCustomLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Adds a custom log level that will be added as an additional method to Logger.\nLogger will call the corresponding method on any appenders that support it."},"parameters":[{"id":68,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name for the new log level."},"type":{"type":"instrinct","name":"string"}},{"id":69,"name":"value","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The numeric severity value for the level (higher is more severe).\n"},"type":{"type":"instrinct","name":"number"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":64,"name":"clearAppenders","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":65,"name":"clearAppenders","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes all appenders."},"type":{"type":"instrinct","name":"void"}}]},{"id":62,"name":"getAppenders","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":63,"name":"getAppenders","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Gets an array of all appenders."},"type":{"type":"instrinct","name":"any"}}]},{"id":76,"name":"getLevel","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":77,"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":53,"name":"getLogger","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":54,"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":55,"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":27}}]},{"id":59,"name":"removeAppender","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":60,"name":"removeAppender","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes an appender."},"parameters":[{"id":61,"name":"appender","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"An appender that has been added previously.\n"},"type":{"type":"reference","name":"Appender","id":10}}],"type":{"type":"instrinct","name":"void"}}]},{"id":70,"name":"removeCustomLevel","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":71,"name":"removeCustomLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Removes a custom log level."},"parameters":[{"id":72,"name":"name","kind":32768,"kindString":"Parameter","flags":{},"comment":{"text":"The name of a custom log level that has been added previously.\n"},"type":{"type":"instrinct","name":"string"}}],"type":{"type":"instrinct","name":"void"}}]},{"id":73,"name":"setLevel","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":74,"name":"setLevel","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Sets the level of logging for ALL the application loggers."},"parameters":[{"id":75,"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":[27]},{"title":"Interfaces","kind":256,"children":[10,2]},{"title":"Variables","kind":32,"children":[52]},{"title":"Functions","kind":64,"children":[56,66,64,62,76,53,59,70,73]}]}

@@ -0,1 +1,11 @@

<a name="1.4.0"></a>
# [1.4.0](https://github.com/aurelia/logging/compare/1.3.1...v1.4.0) (2017-12-20)
### Features
* **log-manager:** add custom log levels ([9b5b245](https://github.com/aurelia/logging/commit/9b5b245)), closes [#33](https://github.com/aurelia/logging/issues/33)
<a name="1.3.1"></a>

@@ -2,0 +12,0 @@ ## [1.3.1](https://github.com/aurelia/logging/compare/1.3.0...v1.3.1) (2017-03-26)

{
"name": "aurelia-logging",
"version": "1.3.1",
"version": "1.4.0",
"description": "A minimal but effective logging mechanism with support for log levels and pluggable log appenders.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -24,3 +24,8 @@ /**

*/
debug: number
debug: number,
/**
* Additional log levels defined at runtime.
*/
[level: string]: number
}

@@ -33,6 +38,6 @@

none: 0,
error: 1,
warn: 2,
info: 3,
debug: 4
error: 10,
warn: 20,
info: 30,
debug: 40
};

@@ -44,2 +49,7 @@

const standardLevels = ['none', 'error', 'warn', 'info', 'debug'];
function isStandardLevel(level: string) {
return standardLevels.filter(l => l === level).length > 0;
}
function appendArgs() {

@@ -67,10 +77,47 @@ return [this, ...arguments];

function logFactoryCustom(level) {
//This function is the same as logFactory() except that it checks that the method
//is defined on the appender.
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--) {
const appender = appenders[i];
if (appender[level] !== undefined) {
appender[level](...args);
}
}
};
}
function connectLoggers() {
let proto = Logger.prototype;
proto.debug = logFactory('debug');
proto.info = logFactory('info');
proto.warn = logFactory('warn');
proto.error = logFactory('error');
for (let level in logLevel) {
if (isStandardLevel(level)) {
if (level !== 'none') {
proto[level] = logFactory(level);
}
} else {
proto[level] = logFactoryCustom(level);
}
}
}
function disconnectLoggers() {
let proto = Logger.prototype;
for (let level in logLevel) {
if (level !== 'none') {
proto[level] = function() { };
}
}
}
/**

@@ -90,2 +137,3 @@ * Gets the instance of a logger associated with a particular id (or creates one if it doesn't already exist).

interface Appender {
/**

@@ -136,3 +184,3 @@ * Appends a debug log.

/**
* Removes an appender
* Removes an appender.
* @param appender An appender that has been added previously.

@@ -145,2 +193,61 @@ */

/**
* Gets an array of all appenders.
*/
export function getAppenders() {
return [...appenders];
}
/**
* Removes all appenders.
*/
export function clearAppenders(): void {
appenders = [];
disconnectLoggers();
}
/**
* Adds a custom log level that will be added as an additional method to Logger.
* Logger will call the corresponding method on any appenders that support it.
*
* @param name The name for the new log level.
* @param value The numeric severity value for the level (higher is more severe).
*/
export function addCustomLevel(name: string, value: number): void {
if (logLevel[name] !== undefined) {
throw Error(`Log level "${name}" already exists.`);
}
if (isNaN(value)) {
throw Error('Value must be a number.');
}
logLevel[name] = value;
if (appenders.length > 0) {
//Reinitialize the Logger prototype with the new method.
connectLoggers();
} else {
//Add the custom level as a noop by default.
Logger.prototype[name] = function() { };
}
}
/**
* Removes a custom log level.
* @param name The name of a custom log level that has been added previously.
*/
export function removeCustomLevel(name: string): void {
if (logLevel[name] === undefined) {
return;
}
if (isStandardLevel(name)) {
throw Error(`Built-in log level "${name}" cannot be removed.`);
}
delete logLevel[name];
delete Logger.prototype[name];
}
/**
* Sets the level of logging for ALL the application loggers.

@@ -147,0 +254,0 @@ *

@@ -32,2 +32,3 @@ import * as LogManager from '../src/index';

LogManager.clearAppenders();
LogManager.addAppender(testAppender);

@@ -39,2 +40,24 @@

describe('when calling getAppenders ', () => {
it('should return an array of added appenders', () => {
const testAppender2 = new TestAppender();
LogManager.addAppender(testAppender2);
const appenders = LogManager.getAppenders();
expect(appenders instanceof Array).toBeTruthy();
expect(appenders).toEqual([testAppender, testAppender2]);
});
it('should not expose the internal appenders array', () => {
LogManager.getAppenders().push(new TestAppender());
expect(LogManager.getAppenders()).toEqual([testAppender]);
});
});
it('should remove all appenders when calling clearAppenders', () => {
LogManager.addAppender(new TestAppender());
expect(LogManager.getAppenders().length).toBe(2);
LogManager.clearAppenders();
expect(LogManager.getAppenders().length).toBe(0);
});
it('should remove the test appender', () => {

@@ -44,4 +67,8 @@ LogManager.setLevel(LogManager.logLevel.debug);

logger.debug('foo');
expect(testAppender.debug.calls.count()).toBe(0)
expect(testAppender.debug.calls.count()).toBe(0);
});
it('should not add logLevel "none" as a method of Logger.', () => {
expect(logger.none).toBeUndefined();
});

@@ -64,3 +91,3 @@ it('should call only call debug when logLevel is debug', () => {

expect(testAppender.debug.calls.count()).toBe(1)
expect(testAppender.debug.calls.count()).toBe(1);
});

@@ -84,3 +111,3 @@

expect(testAppender.info.calls.count()).toBe(2)
expect(testAppender.info.calls.count()).toBe(2);
});

@@ -104,3 +131,3 @@

expect(testAppender.warn.calls.count()).toBe(3)
expect(testAppender.warn.calls.count()).toBe(3);
});

@@ -124,3 +151,3 @@

expect(testAppender.error.calls.count()).toBe(4)
expect(testAppender.error.calls.count()).toBe(4);
});

@@ -127,0 +154,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc