Skip to content

Commit

Permalink
Logger.useDefaults() expects an options hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyreeves committed Sep 10, 2015
1 parent f90f33c commit 7fede74
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "js-logger",
"version": "1.1.1",
"version": "1.2.0",
"main": "src/logger.js",
"ignore": [
"**/.*",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "js-logger",
"version": "1.1.1",
"version": "1.2.0",
"description": "Lightweight, unobtrusive, configurable JavaScript logger",
"author": "Jonny Reeves (http://jonnyreeves.co.uk)",
"homepage": "http://github.com/jonnyreeves/js-logger",
Expand Down
20 changes: 11 additions & 9 deletions src/logger.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*!
* js-logger - http://github.com/jonnyreeves/js-logger
* js-logger - http://github.com/jonnyreeves/js-logger
* Jonny Reeves, http://jonnyreeves.co.uk/
* js-logger may be freely distributed under the MIT license.
* js-logger may be freely distributed under the MIT license.
*/
(function (global) {
"use strict";

// Top level module for the global, static logger instance.
var Logger = { };

// For those that are at home that are keeping score.
Logger.VERSION = "1.1.1";
Logger.VERSION = "1.2.0";

// Function which handles all incoming log messages.
var logHandler;

// Map of ContextualLogger instances by name; used by Logger.get() to return the same named instance.
var contextualLoggersByNameMap = {};

Expand Down Expand Up @@ -160,7 +160,9 @@
};

// Configure and example a Default implementation which writes to the `window.console` (if present).
Logger.useDefaults = function(defaultLevel) {
Logger.useDefaults = function(options) {
options = options || {};

// Check for the presence of a logger.
if (typeof console === "undefined") {
return;
Expand All @@ -175,7 +177,7 @@
Function.prototype.apply.call(hdlr, console, messages);
};

Logger.setLevel(defaultLevel || Logger.DEBUG);
Logger.setLevel(options.defaultLevel || Logger.DEBUG);
Logger.setHandler(function(messages, context) {
var hdlr = console.log;
var timerLabel;
Expand Down Expand Up @@ -238,4 +240,4 @@

global.Logger = Logger;
}
}(this));
}(this));
2 changes: 1 addition & 1 deletion src/logger.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7fede74

Please sign in to comment.