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:
BrennanConroy 2018-04-02 19:25:47 -07:00 committed by David Fowler
parent 416b27c6d6
commit 221c95e0af
6 changed files with 31 additions and 1 deletions

View File

@ -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) {
const url = window.location.href;

View File

@ -1,6 +1,8 @@
// 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 asyncit(expectation: string, assertion?: () => Promise<any> | void, timeout?: number): void {
let testFunction: (done: DoneFn) => void;
if (assertion) {

View File

@ -1,6 +1,8 @@
// 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 class Arg {
public static isRequired(val: any, name: string): void {
if (val === null || val === undefined) {

View File

@ -160,6 +160,7 @@ namespace Microsoft.AspNetCore.Http.Connections.Client.Internal
// or if the consumer is done
if (flushResult.IsCanceled || flushResult.IsCompleted)
{
Log.EventStreamEnded(_logger);
break;
}
}

View File

@ -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
Log.ErrorReceivingHandshakeResponse(_logger, ex);

View File

@ -57,6 +57,8 @@ namespace Microsoft.AspNetCore.SignalR
throw new InvalidOperationException("There are no supported protocols");
}
Log.ConnectedStarting(_logger);
var connectionContext = new HubConnectionContext(connection, keepAlive, _loggerFactory);
if (!await connectionContext.HandshakeAsync(handshakeTimeout, supportedProtocols, _protocolResolver, _userIdProvider, _enableDetailedErrors))
@ -71,6 +73,7 @@ namespace Microsoft.AspNetCore.SignalR
}
finally
{
Log.ConnectedEnding(_logger);
await _lifetimeManager.OnDisconnectedAsync(connectionContext);
}
}
@ -215,6 +218,12 @@ namespace Microsoft.AspNetCore.SignalR
private static readonly Action<ILogger, Exception> _errorSendingClose =
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)
{
_errorDispatchingHubEvent(logger, hubMethod, exception);
@ -234,6 +243,16 @@ namespace Microsoft.AspNetCore.SignalR
{
_errorSendingClose(logger, exception);
}
public static void ConnectedStarting(ILogger logger)
{
_connectedStarting(logger, null);
}
public static void ConnectedEnding(ILogger logger)
{
_connectedEnding(logger, null);
}
}
}
}