Skip to content

Commit 56a3853

Browse files
committed
Add DEBUG_HIDE_TTY_DATE env var (#486)
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
1 parent bdb7e01 commit 56a3853

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Diff for: README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# debug
2-
[![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)
2+
[![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)
33
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
44

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

153154

154155
__Note:__ The environment variables beginning with `DEBUG_` end up being
@@ -269,7 +270,7 @@ enabled or disabled.
269270
- TJ Holowaychuk
270271
- Nathan Rajlich
271272
- Andrew Rhyne
272-
273+
273274
## Backers
274275

275276
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]

Diff for: src/node.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,15 @@ function formatArgs(args) {
115115
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
116116
args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
117117
} else {
118-
args[0] = new Date().toISOString()
119-
+ ' ' + name + ' ' + args[0];
118+
args[0] = getDate() + name + ' ' + args[0];
119+
}
120+
}
121+
122+
function getDate() {
123+
if (exports.inspectOpts.hideTtyDate) {
124+
return '';
125+
} else {
126+
return new Date().toISOString() + ' ';
120127
}
121128
}
122129

0 commit comments

Comments
 (0)