Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use console.debug() in browser when available #659

Merged
merged 1 commit into from Dec 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/browser.js
Expand Up @@ -4,7 +4,6 @@
* This is the web browser implementation of `debug()`.
*/

exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
Expand Down Expand Up @@ -170,18 +169,14 @@ function formatArgs(args) {
}

/**
* Invokes `console.log()` when available.
* No-op when `console.log` is not a "function".
* Invokes `console.debug()` when available.
* No-op when `console.debug` is not a "function".
* If `console.debug` is not available, falls back
* to `console.log`.
*
* @api public
*/
function log(...args) {
// This hackery is required for IE8/9, where
// the `console.log` function doesn't have 'apply'
return typeof console === 'object' &&
console.log &&
console.log(...args);
}
exports.log = console.debug || console.log || (() => {});

/**
* Save `namespaces`.
Expand Down