From 9dd6a2b9ca3b1f0d9852ecf0e64ccc6dacf04fa7 Mon Sep 17 00:00:00 2001 From: Adrian Mejia Date: Sat, 12 Aug 2017 15:05:53 -0400 Subject: [PATCH 1/4] enables DEBUG_HIDE_TTY_DATE --- src/node.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/node.js b/src/node.js index b85ec7e3..fd0175b1 100644 --- a/src/node.js +++ b/src/node.js @@ -55,6 +55,8 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) { .toLowerCase() .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); + console.log('key', key); + // coerce string value into JS value var val = process.env[key]; if (/^(yes|on|true|enabled)$/i.test(val)) val = true; @@ -113,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 ('hideTtyDate' in this.inspectOpts && this.inspectOpts.hideTtyDate) { + return ''; + } else { + return new Date().toISOString() + ' '; } } From e09dec33c15fae136039c7ebd94c23000a35373f Mon Sep 17 00:00:00 2001 From: Adrian Mejia Date: Sat, 12 Aug 2017 15:19:10 -0400 Subject: [PATCH 2/4] cleanup --- src/node.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/node.js b/src/node.js index fd0175b1..cb3b2194 100644 --- a/src/node.js +++ b/src/node.js @@ -23,7 +23,7 @@ exports.useColors = useColors; * Colors. */ -exports.colors = [ 6, 2, 3, 4, 5, 1 ]; +exports.colors = [6, 2, 3, 4, 5, 1]; try { var supportsColor = require('supports-color'); @@ -82,7 +82,7 @@ function useColors() { * Map %o to `util.inspect()`, all on a single line. */ -exports.formatters.o = function(v) { +exports.formatters.o = function (v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts) .replace(/\s*\n\s*/g, ' '); @@ -92,7 +92,7 @@ exports.formatters.o = function(v) { * Map %o to `util.inspect()`, allowing multiple lines if needed. */ -exports.formatters.O = function(v) { +exports.formatters.O = function (v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts); }; @@ -120,7 +120,11 @@ function formatArgs(args) { } function getDate() { +<<<<<<< Updated upstream if ('hideTtyDate' in this.inspectOpts && this.inspectOpts.hideTtyDate) { +======= + if ('hideTtyDate' in exports.inspectOpts && exports.inspectOpts.hideTtyDate) { +>>>>>>> Stashed changes return ''; } else { return new Date().toISOString() + ' '; @@ -170,7 +174,7 @@ function load() { * differently for a particular `debug` instance. */ -function init (debug) { +function init(debug) { debug.inspectOpts = {}; var keys = Object.keys(exports.inspectOpts); From 55e5c5e86812163293779e9bbad1afc252c83230 Mon Sep 17 00:00:00 2001 From: Adrian Mejia Date: Sat, 12 Aug 2017 15:21:16 -0400 Subject: [PATCH 3/4] docs --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f3b08e1..9157bfc4 100644 --- a/README.md +++ b/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) @@ -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 @@ -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)] From 62589c0a4e1babc5953ea30c7ef80b3867ed0a04 Mon Sep 17 00:00:00 2001 From: Adrian Mejia Date: Sat, 12 Aug 2017 15:24:45 -0400 Subject: [PATCH 4/4] solves merge conflict --- src/node.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/node.js b/src/node.js index cb3b2194..fc725ce2 100644 --- a/src/node.js +++ b/src/node.js @@ -55,8 +55,6 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) { .toLowerCase() .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); - console.log('key', key); - // coerce string value into JS value var val = process.env[key]; if (/^(yes|on|true|enabled)$/i.test(val)) val = true; @@ -120,11 +118,7 @@ function formatArgs(args) { } function getDate() { -<<<<<<< Updated upstream - if ('hideTtyDate' in this.inspectOpts && this.inspectOpts.hideTtyDate) { -======= if ('hideTtyDate' in exports.inspectOpts && exports.inspectOpts.hideTtyDate) { ->>>>>>> Stashed changes return ''; } else { return new Date().toISOString() + ' ';