Better browser sniffing suggested at 414f33563d (commitcomment-7936060)

master
Trent Mick 2014-09-26 20:46:27 -07:00
parent f5e5d577f0
commit 594cc82da1
1 changed files with 3 additions and 8 deletions

View File

@ -47,13 +47,8 @@ try {
}
// Are we in the browser (e.g. running via browserify)?
var browser;
try {
window
browser = true;
} catch (e) {
browser = false;
}
var isBrowser = function () {
return typeof (window) !== 'undefined' && this === window; }();
@ -380,7 +375,7 @@ function Logger(options, _childOptions, _childSimple) {
} else if (parent && options.level) {
this.level(options.level);
} else if (!parent) {
if (browser) {
if (isBrowser) {
/*
* In the browser we'll be emitting to console.log by default.
* Any console.log worth its salt these days can nicely render