Skip to content

Commit

Permalink
Add DEBUG_HIDE_TTY_DATE env var (#486)
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 62589c0
Author: Adrian Mejia <admejiar@cisco.com>
Date:   Sat Aug 12 15:24:45 2017 -0400

    solves merge conflict

commit 55e5c5e
Author: Adrian Mejia <admejiar@cisco.com>
Date:   Sat Aug 12 15:21:16 2017 -0400

    docs

commit e09dec3
Author: Adrian Mejia <admejiar@cisco.com>
Date:   Sat Aug 12 15:19:10 2017 -0400

    cleanup

commit 9dd6a2b
Author: Adrian Mejia <admejiar@cisco.com>
Date:   Sat Aug 12 15:05:53 2017 -0400

    enables DEBUG_HIDE_TTY_DATE
  • Loading branch information
TooTallNate committed Sep 22, 2017
1 parent bdb7e01 commit 56a3853
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
@@ -1,5 +1,5 @@
# debug
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
[![Build Status](https://travis-ci.org/visionmedia/debug.svg?branch=master)](https://travis-ci.org/visionmedia/debug) [![Coverage Status](https://coveralls.io/repos/github/visionmedia/debug/badge.svg?branch=master)](https://coveralls.io/github/visionmedia/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)

<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
Expand Down Expand Up @@ -149,6 +149,7 @@ change the behavior of the debug logging:
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
| `DEBUG_DEPTH` | Object inspection depth. |
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
| `DEBUG_HIDE_TTY_DATE` | Hide date from debug output on TTY. |


__Note:__ The environment variables beginning with `DEBUG_` end up being
Expand Down Expand Up @@ -269,7 +270,7 @@ enabled or disabled.
- TJ Holowaychuk
- Nathan Rajlich
- Andrew Rhyne

## Backers

Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
Expand Down
11 changes: 9 additions & 2 deletions src/node.js
Expand Up @@ -115,8 +115,15 @@ function formatArgs(args) {
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
} else {
args[0] = new Date().toISOString()
+ ' ' + name + ' ' + args[0];
args[0] = getDate() + name + ' ' + args[0];
}
}

function getDate() {
if (exports.inspectOpts.hideTtyDate) {
return '';
} else {
return new Date().toISOString() + ' ';
}
}

Expand Down

0 comments on commit 56a3853

Please sign in to comment.