Logger for the Browser and NodeJS based on the UMD pattern
This is a console surrogate that works in major Browser vendors (Chrome, Firefox, Safari, IE). Moreover it runs with node.js and polyfills the console behavior we know from the Browser. A convenient feature is that additional to the output of user defined common string messages, the location of the execution is supplied as a trace snippet.
Install the module with: npm install umd-logger
var console = require('umd-logger');
console.setLevel(4);
console.debug('Hello world!'); // default node.js console does not support 'debug'
window.console = window.umd_logger;
console.setLevel(5); // default setting
console.log('Hello world!');
// restore the original console
window.console = console.backup;
console.log('Hello again!');
require(['umd-logger'], function (console) {
console.setLevel(3);
console.info('Hello world!');
})
Copyright (c) 2014 Christian H. Schulz
Licensed under the MIT license.