зеркало из https://github.com/mozilla/gecko-dev.git
bug 1606612: remote: pretty-print WebSocket JSON payloads when verbose logging r=remote-protocol-reviewers,whimboo
When remote.log.level is Log.Level.Info or above, verbose logging is enabled and we pretty-print JSON payloads in requests to the HTTPD in JSONHandler. This patch matches the behaviour of the JSONHandler logging, where JSON payloads are logged to stdout with special formatting before being transmitted across WebSocket connections. Differential Revision: https://phabricator.services.mozilla.com/D58506 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4f8001ba30
Коммит
8b58648e51
|
@ -6,11 +6,11 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ["Connection"];
|
||||
|
||||
const { Log } = ChromeUtils.import("chrome://remote/content/Log.jsm");
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
|
||||
const { Log } = ChromeUtils.import("chrome://remote/content/Log.jsm");
|
||||
const { UnknownMethodError } = ChromeUtils.import(
|
||||
"chrome://remote/content/Error.jsm"
|
||||
);
|
||||
|
@ -61,9 +61,10 @@ class Connection {
|
|||
this.sessions.set(session.id, session);
|
||||
}
|
||||
|
||||
send(message) {
|
||||
log.trace(`<-(connection ${this.id}) ${JSON.stringify(message)}`);
|
||||
this.transport.send(message);
|
||||
send(body) {
|
||||
const payload = JSON.stringify(body, null, Log.verbose ? "\t" : null);
|
||||
log.trace(`<-(connection ${this.id}) ${payload}`);
|
||||
this.transport.send(JSON.parse(payload));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче