Skip to content
Myr

deprecation messages are bright red on TTYs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent f7be983 · Browse files · 1 file+13 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−4 removed

  • other:+13 added−4 removed

1 file+13 added−4 removed

modified:lib/utils.js+13 added-4 removed
12 unmodified lines
1314var toString = {}.toString;1516/**17 * Deprecate function, like core `util.deprecate`17 * Deprecate function, like core `util.deprecate`,18 * but with NODE_ENV and color support.19 *20 * @param {Function} fn21 * @param {String} msg22 * @return {Function}23 * @api private24 */2526exports.deprecate = function(fn, msg){26 return 'test' !== process.env.NODE_ENV27 ? deprecate(fn, 'express: ' + msg)28 : fn;27 if (process.env.NODE_ENV === 'test') return fn;2829 // prepend module name30 msg = 'express: ' + msg;3132 if (process.stderr.isTTY) {33 // colorize34 msg = '\x1b[31;1m' + msg + '\x1b[0m';35 }3637 return deprecate(fn, msg);38};3940/**41 * Return ETag for `body`.
298 unmodified lines