Comparing version
@@ -0,1 +1,6 @@ | ||
## 0.9.6 (20th May, 2014) | ||
Bugfixes: | ||
- `Logger.useDefaults()` now supports IE8+ (#4, @AdrianTP) | ||
## 0.9.5 (19th May, 2014) | ||
@@ -2,0 +7,0 @@ |
{ | ||
"name": "js-logger", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"description": "Lightweight, unobtrusive, configurable JavaScript logger", | ||
@@ -5,0 +5,0 @@ "author": "Jonny Reeves (http://jonnyreeves.co.uk)", |
@@ -48,3 +48,3 @@ /*! | ||
}; | ||
// Predefined logging levels. | ||
@@ -64,3 +64,3 @@ Logger.DEBUG = defineLogLevel(1, 'DEBUG'); | ||
}; | ||
ContextualLogger.prototype = { | ||
@@ -80,3 +80,3 @@ // Changes the current logging level for the logging instance. | ||
}, | ||
debug: function () { | ||
@@ -89,3 +89,3 @@ this.invoke(Logger.DEBUG, arguments); | ||
}, | ||
warn: function () { | ||
@@ -98,3 +98,3 @@ this.invoke(Logger.WARN, arguments); | ||
}, | ||
// Invokes the logger callback if it's not being filtered. | ||
@@ -106,12 +106,12 @@ invoke: function (level, msgArgs) { | ||
} | ||
}; | ||
}; | ||
// Protected instance which all calls to the to level `Logger` module will be routed through. | ||
var globalLogger = new ContextualLogger({ filterLevel: Logger.OFF }); | ||
// Configure the global Logger instance. | ||
(function() { | ||
(function() { | ||
// Shortcut for optimisers. | ||
var L = Logger; | ||
L.enabledFor = bind(globalLogger, globalLogger.enabledFor); | ||
@@ -122,3 +122,3 @@ L.debug = bind(globalLogger, globalLogger.debug); | ||
L.error = bind(globalLogger, globalLogger.error); | ||
// Don't forget the convenience alias! | ||
@@ -140,3 +140,3 @@ L.log = L.info; | ||
globalLogger.setLevel(level); | ||
// Apply this level to all registered contextual loggers. | ||
@@ -154,6 +154,6 @@ for (var key in contextualLoggersByNameMap) { | ||
// All logger instances are cached so they can be configured ahead of use. | ||
return contextualLoggersByNameMap[name] || | ||
return contextualLoggersByNameMap[name] || | ||
(contextualLoggersByNameMap[name] = new ContextualLogger(merge({ name: name }, globalLogger.context))); | ||
}; | ||
}; | ||
// Configure and example a Default implementation which writes to the `window.console` (if present). | ||
@@ -163,3 +163,2 @@ Logger.useDefaults = function(defaultLevel) { | ||
if (!console) { | ||
console.log("no console"); | ||
return; | ||
@@ -176,3 +175,3 @@ } | ||
} | ||
// Delegate through to custom warn/error loggers if present on the console. | ||
@@ -187,3 +186,4 @@ if (context.level === Logger.WARN && console.warn) { | ||
hdlr.apply(console, messages); | ||
// Support for IE8+ (and other, slightly more sane environments) | ||
Function.prototype.apply.call(hdlr, console, messages); | ||
}); | ||
@@ -190,0 +190,0 @@ }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
79549
0.17%0
-100%