Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Don't use octal escape sequences as they cause syntax errors in strict mode #825

Merged
merged 1 commit into from

2 participants

@jamesallardice

Currently, attempting to run an application that depends upon this module in global strict mode (via the --use-strict flag) fails, due to the use of octal escape sequences (used to produce coloured output).

Octal escape sequences are deprecated in ES5 and cause a syntax error in strict mode. Changing the octal sequences to be hex escapes fixes the problem, and should work in all shells that support the octal syntax for colours.

@tj tj merged commit b1e91a5 into senchalabs:master

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/middleware/logger.js
View
8 lib/middleware/logger.js
@@ -237,13 +237,13 @@ exports.format('dev', function(tokens, req, res){
? ''
: len = ' - ' + bytes(len);
- return '\033[90m' + req.method
+ return '\x1b[90m' + req.method
+ ' ' + req.originalUrl + ' '
- + '\033[' + color + 'm' + res.statusCode
- + ' \033[90m'
+ + '\x1b[' + color + 'm' + res.statusCode
+ + ' \x1b[90m'
+ (new Date - req._startTime)
+ 'ms' + len
- + '\033[0m';
+ + '\x1b[0m';
});
/**
Something went wrong with that request. Please try again.