Remove logging and clone utlities (#5309)

* remove log utility functions; remove custom mixin

* fix tests

* add log service as required by telemetry utils

* remove unused code

* replace some console.logs with logservice
This commit is contained in:
Anthony Dresser
2019-05-04 22:37:15 -07:00
committed by GitHub
parent df7645e4e5
commit ab0cd71d10
80 changed files with 439 additions and 383 deletions

View File

@@ -23,7 +23,6 @@ import { ConnectionGlobalStatus } from 'sql/workbench/parts/connection/common/co
import { ConnectionStatusbarItem } from 'sql/workbench/parts/connection/browser/connectionStatus';
import * as TelemetryKeys from 'sql/platform/telemetry/telemetryKeys';
import * as TelemetryUtils from 'sql/platform/telemetry/telemetryUtilities';
import { warn } from 'sql/base/common/log';
import { IResourceProviderService } from 'sql/workbench/services/resourceProvider/common/resourceProviderService';
import { IAngularEventingService, AngularEventType } from 'sql/platform/angularEventing/common/angularEventingService';
import * as QueryConstants from 'sql/workbench/parts/query/common/constants';
@@ -52,6 +51,7 @@ import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { IConnectionDialogService } from 'sql/workbench/services/connection/common/connectionDialogService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILogService } from 'vs/platform/log/common/log';
export class ConnectionManagementService extends Disposable implements IConnectionManagementService {
@@ -86,7 +86,8 @@ export class ConnectionManagementService extends Disposable implements IConnecti
@IStatusbarService private _statusBarService: IStatusbarService,
@IResourceProviderService private _resourceProviderService: IResourceProviderService,
@IAngularEventingService private _angularEventing: IAngularEventingService,
@IAccountManagementService private _accountManagementService: IAccountManagementService
@IAccountManagementService private _accountManagementService: IAccountManagementService,
@ILogService private logService: ILogService
) {
super();
@@ -192,7 +193,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
self._connectionDialogService.showDialog(self, params, model, connectionResult).then(() => {
resolve();
}, dialogError => {
warn('failed to open the connection dialog. error: ' + dialogError);
this.logService.warn('failed to open the connection dialog. error: ' + dialogError);
reject(dialogError);
});
});
@@ -351,7 +352,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
if (uri !== input.uri) {
//TODO: this should never happen. If the input is already passed, it should have the uri
warn(`the given uri is different that the input uri. ${uri}|${input.uri}`);
this.logService.warn(`the given uri is different that the input uri. ${uri}|${input.uri}`);
}
return this.tryConnect(connection, input, options);
}
@@ -628,7 +629,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
public saveProfileGroup(profile: IConnectionProfileGroup): Promise<string> {
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.AddServerGroup);
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.AddServerGroup);
return new Promise<string>((resolve, reject) => {
this._connectionStore.saveProfileGroup(profile).then(groupId => {
this._onAddConnectionProfile.fire(undefined);
@@ -857,7 +858,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
private addTelemetryForConnection(connection: ConnectionManagementInfo): void {
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.DatabaseConnected, {
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.DatabaseConnected, {
connectionType: connection.serverInfo ? (connection.serverInfo.isCloud ? 'Azure' : 'Standalone') : '',
provider: connection.connectionProfile.providerName,
serverVersion: connection.serverInfo ? connection.serverInfo.serverVersion : '',
@@ -869,7 +870,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
private addTelemetryForConnectionDisconnected(connection: IConnectionProfile): void {
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.DatabaseDisconnected, {
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.DatabaseDisconnected, {
provider: connection.providerName
});
}
@@ -914,13 +915,13 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
public changeGroupIdForConnectionGroup(source: ConnectionProfileGroup, target: ConnectionProfileGroup): Promise<void> {
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.MoveServerConnection);
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.MoveServerConnection);
return this._connectionStore.changeGroupIdForConnectionGroup(source, target);
}
public changeGroupIdForConnection(source: ConnectionProfile, targetGroupId: string): Promise<void> {
let id = Utils.generateUri(source);
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.MoveServerGroup);
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.MoveServerGroup);
return this._connectionStore.changeGroupIdForConnection(source, targetGroupId).then(result => {
if (id && targetGroupId) {
source.groupId = targetGroupId;
@@ -1204,7 +1205,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
*/
public deleteConnection(connection: ConnectionProfile): Promise<boolean> {
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.DeleteConnection, {}, connection);
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.DeleteConnection, {}, connection);
// Disconnect if connected
let uri = Utils.generateUri(connection);
if (this.isConnected(uri) || this.isConnecting(uri)) {
@@ -1242,7 +1243,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* Disconnects a connection before removing from config. If disconnect fails, settings is not modified.
*/
public deleteConnectionGroup(group: ConnectionProfileGroup): Promise<boolean> {
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.DeleteServerGroup);
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.DeleteServerGroup);
// Get all connections for this group
let connections = ConnectionProfileGroup.getConnectionsInGroup(group);