8000 Custom output formatting by chagris · Pull Request #645 · debug-js/debug · GitHub
[go: up one dir, main page]

Skip to content

Custom output formatting #645

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add %d outputFormatter to show exact ms diff
  • Loading branch information
chagris committed Dec 14, 2018
commit 69b5a48ce4fcbaab2fa400e122785c86017ac29e
10 changes: 9 additions & 1 deletion src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,21 @@ function setup(env) {
}

/**
* Map %+ to outputting diff
* Map %+ to humanize()'s defaults (1000ms diff => "1s")
*/

createDebug.outputFormatters['+'] = function(format, args) {
return '+' + createDebug.humanize(this.diff);
}

/**
* Map %d to returning milliseconds
*/

createDebug.outputFormatters.d = function(format, args) {
return '+' + this.diff + "ms";
}

/**
* Map %n to outputting namespace prefix
*/
Expand Down
0