From 15af5193af71a79da94042745eaa3e153d135401 Mon Sep 17 00:00:00 2001 From: toshi1127 Date: Wed, 20 Mar 2019 02:27:08 +0900 Subject: [PATCH] http2: reduce usage of require('util') PR-URL: https://github.com/nodejs/node/pull/26784 Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Yongsheng Zhang --- lib/internal/http2/core.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index b2a453d2e6057e..cd3429270fca6a 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -18,7 +18,6 @@ const net = require('net'); const { Duplex } = require('stream'); const tls = require('tls'); const { URL } = require('url'); -const util = require('util'); const { kIncomingMessage } = require('_http_common'); const { kServerResponse } = require('_http_server'); @@ -120,6 +119,7 @@ const { validateTimerDuration } = require('internal/timers'); const { isArrayBufferView } = require('internal/util/types'); +const { format } = require('internal/util/inspect'); const hasOwnProperty = Object.prototype.hasOwnProperty; @@ -134,7 +134,7 @@ const { UV_EOF } = internalBinding('uv'); const { StreamPipe } = internalBinding('stream_pipe'); const { _connectionListener: httpConnectionListener } = http; -const debug = util.debuglog('http2'); +const debug = require('internal/util/debuglog').debuglog('http2'); const kMaxFrameSize = (2 ** 24) - 1; const kMaxInt = (2 ** 32) - 1; @@ -1087,7 +1087,7 @@ class Http2Session extends EventEmitter { localSettings: this.localSettings, remoteSettings: this.remoteSettings }; - return `Http2Session ${util.format(obj)}`; + return `Http2Session ${format(obj)}`; } // The socket owned by this session @@ -1663,7 +1663,7 @@ class Http2Stream extends Duplex { readableState: this._readableState, writableState: this._writableState }; - return `Http2Stream ${util.format(obj)}`; + return `Http2Stream ${format(obj)}`; } get bufferSize() {