diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/ILogger.ts b/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/ILogger.ts index b45dadf4ef..b04154cf92 100644 --- a/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/ILogger.ts +++ b/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/ILogger.ts @@ -2,7 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. export enum LogLevel { - Information = 0, + Trace = 0, + Information, Warning, Error, None diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/Transports.ts b/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/Transports.ts index ecadd77ffa..fe740cf66f 100644 --- a/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/Transports.ts +++ b/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/Transports.ts @@ -54,7 +54,7 @@ export class WebSocketTransport implements ITransport { }; webSocket.onmessage = (message: MessageEvent) => { - this.logger.log(LogLevel.Information, `(WebSockets transport) data received: ${message.data}`); + this.logger.log(LogLevel.Trace, `(WebSockets transport) data received: ${message.data}`); if (this.onDataReceived) { this.onDataReceived(message.data); } @@ -118,7 +118,7 @@ export class ServerSentEventsTransport implements ITransport { eventSource.onmessage = (e: MessageEvent) => { if (this.onDataReceived) { try { - this.logger.log(LogLevel.Information, `(SSE transport) data received: ${e.data}`); + this.logger.log(LogLevel.Trace, `(SSE transport) data received: ${e.data}`); this.onDataReceived(e.data); } catch (error) { if (this.onClosed) { @@ -208,7 +208,7 @@ export class LongPollingTransport implements ITransport { : pollXhr.response; if (response) { - this.logger.log(LogLevel.Information, `(LongPolling transport) data received: ${response}`); + this.logger.log(LogLevel.Trace, `(LongPolling transport) data received: ${response}`); this.onDataReceived(response); } else { diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/connectionTests.js b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/connectionTests.js index d2c6e59911..da387cc182 100644 --- a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/connectionTests.js +++ b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/connectionTests.js @@ -34,7 +34,7 @@ describe('connection', function () { var message = "Hello World!"; var connection = new signalR.HttpConnection(ECHOENDPOINT_URL, { transport: transportType, - logger: signalR.LogLevel.Information + logging: signalR.LogLevel.Trace }); var received = ""; diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/hubConnectionTests.js b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/hubConnectionTests.js index d91a9d505d..97b9d3d508 100644 --- a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/hubConnectionTests.js +++ b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/hubConnectionTests.js @@ -11,7 +11,13 @@ describe('hubConnection', function () { it('can invoke server method and receive result', function (done) { var message = "你好,世界!"; - var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, { transport: transportType }), { protocol: protocol}); + + var options = { + transport: transportType, + protocol: protocol, + logging: signalR.LogLevel.Trace + }; + var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, options), options); hubConnection.onClosed = function (error) { expect(error).toBe(undefined); done(); @@ -32,7 +38,13 @@ describe('hubConnection', function () { }); it('can stream server method and receive result', function (done) { - var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, { transport: transportType }), { protocol: protocol}); + + var options = { + transport: transportType, + protocol: protocol, + logging: signalR.LogLevel.Trace + }; + var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, options), options); hubConnection.onClosed = function (error) { expect(error).toBe(undefined); @@ -62,7 +74,12 @@ describe('hubConnection', function () { it('rethrows an exception from the server when invoking', function (done) { var errorMessage = "An error occurred."; - var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, { transport: transportType }), { protocol: protocol}); + var options = { + transport: transportType, + protocol: protocol, + logging: signalR.LogLevel.Trace + }; + var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, options), options); hubConnection.start().then(function () { hubConnection.invoke('ThrowException', errorMessage).then(function () { @@ -83,8 +100,12 @@ describe('hubConnection', function () { it('rethrows an exception from the server when streaming', function (done) { var errorMessage = "An error occurred."; - - var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, { transport: transportType }), { protocol: protocol}); + var options = { + transport: transportType, + protocol: protocol, + logging: signalR.LogLevel.Trace + }; + var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, options), options); hubConnection.start().then(function () { hubConnection.stream('ThrowException', errorMessage).subscribe({ @@ -106,7 +127,12 @@ describe('hubConnection', function () { }); it('can receive server calls', function (done) { - var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, { transport: transportType }), { protocol: protocol}); + var options = { + transport: transportType, + protocol: protocol, + logging: signalR.LogLevel.Trace + }; + var hubConnection = new signalR.HubConnection(new signalR.HttpConnection(TESTHUBENDPOINT_URL, options), options); var message = "你好 SignalR!"; @@ -134,7 +160,12 @@ describe('hubConnection', function () { ServerSentEvents: "Error occurred" }; - var hubConnection = new signalR.HubConnection(new signalR.HttpConnection('http://' + document.location.host + '/uncreatable', { transport: transportType }), { protocol: protocol}); + var options = { + transport: transportType, + protocol: protocol, + logging: signalR.LogLevel.Trace + }; + var hubConnection = new signalR.HubConnection(new signalR.HttpConnection('http://' + document.location.host + '/uncreatable', options), options); hubConnection.onClosed = function (error) { expect(error.message).toMatch(errorRegex[signalR.TransportType[transportType]]);