Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: replace sprintf-like format to template string literal #691

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/_debug_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports.start = function start() {

agent.listen(process._debugAPI.port, function() {
var addr = this.address();
process._rawDebug('Debugger listening on port %d', addr.port);
process._rawDebug(`Debugger listening on port ${addr.port}`);
process._debugAPI.notifyListen();
});

Expand Down
4 changes: 2 additions & 2 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function connectionListener(socket) {

function socketOnData(d) {
assert(!socket._paused);
debug('SERVER socketOnData %d', d.length);
debug(`SERVER socketOnData ${d.length}`);
var ret = parser.execute(d);
if (ret instanceof Error) {
debug('parse error');
Expand All @@ -337,7 +337,7 @@ function connectionListener(socket) {

var eventName = req.method === 'CONNECT' ? 'connect' : 'upgrade';
if (EventEmitter.listenerCount(self, eventName) > 0) {
debug('SERVER have listener for %s', eventName);
debug(`SERVER have listener for ${eventName}`);
var bodyHead = d.slice(bytesParsed, d.length);

// TODO(isaacs): Need a way to reset a stream to fresh state
Expand Down
16 changes: 8 additions & 8 deletions lib/_tls_legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ CryptoStream.prototype._write = function write(data, encoding, cb) {
// Write current buffer now
var written;
if (this === this.pair.cleartext) {
debug('cleartext.write called with %d bytes', data.length);
debug(`cleartext.write called with ${data.length} bytes`);
written = this.pair.ssl.clearIn(data, 0, data.length);
} else {
debug('encrypted.write called with %d bytes', data.length);
debug(`encrypted.write called with ${data.length} bytes`);
written = this.pair.ssl.encIn(data, 0, data.length);
}

Expand Down Expand Up @@ -215,9 +215,9 @@ CryptoStream.prototype._write = function write(data, encoding, cb) {
this._pendingCallback = cb;

if (this === this.pair.cleartext) {
debug('cleartext.write queued with %d bytes', data.length);
debug(`cleartext.write queued with ${data.length} bytes`);
} else {
debug('encrypted.write queued with %d bytes', data.length);
debug(`encrypted.write queued with ${data.length} bytes`);
}
};

Expand All @@ -244,10 +244,10 @@ CryptoStream.prototype._read = function read(size) {

var out;
if (this === this.pair.cleartext) {
debug('cleartext.read called with %d bytes', size);
debug(`cleartext.read called with ${size} bytes`);
out = this.pair.ssl.clearOut;
} else {
debug('encrypted.read called with %d bytes', size);
debug(`encrypted.read called with ${size} bytes`);
out = this.pair.ssl.encOut;
}

Expand Down Expand Up @@ -282,9 +282,9 @@ CryptoStream.prototype._read = function read(size) {
assert(bytesRead >= 0);

if (this === this.pair.cleartext) {
debug('cleartext.read succeed with %d bytes', bytesRead);
debug(`cleartext.read succeed with ${bytesRead} bytes`);
} else {
debug('encrypted.read succeed with %d bytes', bytesRead);
debug(`encrypted.read succeed with ${bytesRead} bytes`);
}

// Try writing pending data
Expand Down
6 changes: 2 additions & 4 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -1265,10 +1265,8 @@ function spawnSync(/*file, args, options*/) {
else if (util.isString(input))
pipe.input = new Buffer(input, options.encoding);
else
throw new TypeError(util.format(
'stdio[%d] should be Buffer or string not %s',
i,
typeof input));
throw new TypeError(
`stdio[${i}] should be Buffer or string not ${typeof input}`);
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ EventEmitter.prototype.addListener = function addListener(type, listener) {
if (m && m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d %s listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length, type);
`leak detected. ${this._events[type]} ${type} ` +
'listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.');
console.trace();
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ function listOnTimeout() {
var msecs = this.msecs;
var list = this;

debug('timeout callback %d', msecs);
debug(`timeout callback ${msecs}`);

var now = Timer.now();
debug('now: %s', now);
debug('now: ' + now);

var diff, first, threw;
while (first = L.peek(list)) {
diff = now - first._idleStart;
if (diff < msecs) {
list.start(msecs - diff, 0);
debug('%d list wait because diff is %d', msecs, diff);
debug(`${msecs} list wait because diff is ${diff}`);
return;
} else {
L.remove(first);
Expand Down Expand Up @@ -107,7 +107,7 @@ function listOnTimeout() {
}
}

debug('%d list empty', msecs);
debug(`${msecs} list empty`);
assert(L.isEmpty(list));
list.close();
delete lists[msecs];
Expand Down
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ function timestamp() {

// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
console.log(`${timestamp()} - ${exports.format.apply(exports, arguments)}`);
};


Expand Down