Couple logging additions (#1827)
- Added logging in a couple more places in HubConnection - Increase DEFAULT_TIMEOUT_INTERVAL to 20 seconds
This commit is contained in:
parent
416b27c6d6
commit
221c95e0af
|
|
@ -1,3 +1,7 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
|
||||||
|
|
||||||
export function getParameterByName(name: string) {
|
export function getParameterByName(name: string) {
|
||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
|
||||||
|
|
||||||
export function asyncit(expectation: string, assertion?: () => Promise<any> | void, timeout?: number): void {
|
export function asyncit(expectation: string, assertion?: () => Promise<any> | void, timeout?: number): void {
|
||||||
let testFunction: (done: DoneFn) => void;
|
let testFunction: (done: DoneFn) => void;
|
||||||
if (assertion) {
|
if (assertion) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
|
||||||
|
|
||||||
export class Arg {
|
export class Arg {
|
||||||
public static isRequired(val: any, name: string): void {
|
public static isRequired(val: any, name: string): void {
|
||||||
if (val === null || val === undefined) {
|
if (val === null || val === undefined) {
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
|
||||||
// or if the consumer is done
|
// or if the consumer is done
|
||||||
if (flushResult.IsCanceled || flushResult.IsCompleted)
|
if (flushResult.IsCanceled || flushResult.IsCompleted)
|
||||||
{
|
{
|
||||||
|
Log.EventStreamEnded(_logger);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -553,7 +553,9 @@ namespace Microsoft.AspNetCore.SignalR.Client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
// Ignore HubException because we throw it when we receive a handshake response with an error
|
||||||
|
// And we don't need to log that the handshake failed
|
||||||
|
catch (Exception ex) when (!(ex is HubException))
|
||||||
{
|
{
|
||||||
// shutdown if we're unable to read handshake
|
// shutdown if we're unable to read handshake
|
||||||
Log.ErrorReceivingHandshakeResponse(_logger, ex);
|
Log.ErrorReceivingHandshakeResponse(_logger, ex);
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ namespace Microsoft.AspNetCore.SignalR
|
||||||
throw new InvalidOperationException("There are no supported protocols");
|
throw new InvalidOperationException("There are no supported protocols");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.ConnectedStarting(_logger);
|
||||||
|
|
||||||
var connectionContext = new HubConnectionContext(connection, keepAlive, _loggerFactory);
|
var connectionContext = new HubConnectionContext(connection, keepAlive, _loggerFactory);
|
||||||
|
|
||||||
if (!await connectionContext.HandshakeAsync(handshakeTimeout, supportedProtocols, _protocolResolver, _userIdProvider, _enableDetailedErrors))
|
if (!await connectionContext.HandshakeAsync(handshakeTimeout, supportedProtocols, _protocolResolver, _userIdProvider, _enableDetailedErrors))
|
||||||
|
|
@ -71,6 +73,7 @@ namespace Microsoft.AspNetCore.SignalR
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Log.ConnectedEnding(_logger);
|
||||||
await _lifetimeManager.OnDisconnectedAsync(connectionContext);
|
await _lifetimeManager.OnDisconnectedAsync(connectionContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -215,6 +218,12 @@ namespace Microsoft.AspNetCore.SignalR
|
||||||
private static readonly Action<ILogger, Exception> _errorSendingClose =
|
private static readonly Action<ILogger, Exception> _errorSendingClose =
|
||||||
LoggerMessage.Define(LogLevel.Debug, new EventId(4, "ErrorSendingClose"), "Error when sending Close message.");
|
LoggerMessage.Define(LogLevel.Debug, new EventId(4, "ErrorSendingClose"), "Error when sending Close message.");
|
||||||
|
|
||||||
|
private static readonly Action<ILogger, Exception> _connectedStarting =
|
||||||
|
LoggerMessage.Define(LogLevel.Debug, new EventId(5, "ConnectedStarting"), "OnConnectedAsync started.");
|
||||||
|
|
||||||
|
private static readonly Action<ILogger, Exception> _connectedEnding =
|
||||||
|
LoggerMessage.Define(LogLevel.Debug, new EventId(6, "ConnectedEnding"), "OnConnectedAsync ending.");
|
||||||
|
|
||||||
public static void ErrorDispatchingHubEvent(ILogger logger, string hubMethod, Exception exception)
|
public static void ErrorDispatchingHubEvent(ILogger logger, string hubMethod, Exception exception)
|
||||||
{
|
{
|
||||||
_errorDispatchingHubEvent(logger, hubMethod, exception);
|
_errorDispatchingHubEvent(logger, hubMethod, exception);
|
||||||
|
|
@ -234,6 +243,16 @@ namespace Microsoft.AspNetCore.SignalR
|
||||||
{
|
{
|
||||||
_errorSendingClose(logger, exception);
|
_errorSendingClose(logger, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ConnectedStarting(ILogger logger)
|
||||||
|
{
|
||||||
|
_connectedStarting(logger, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ConnectedEnding(ILogger logger)
|
||||||
|
{
|
||||||
|
_connectedEnding(logger, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue