From f60d448dbadd3457ae1642b6afdb030559435fa2 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 30 Dec 2021 15:31:58 +0300 Subject: [PATCH] settings-sync: improve logging GitOrigin-RevId: 2b1f836c12255b506b632897aa23df4eb5569a8a --- .../intellij/settingsSync/CloudConfigServerCommunicator.kt | 3 ++- .../src/com/intellij/settingsSync/GitSettingsLog.kt | 4 ++-- .../src/com/intellij/settingsSync/SettingsSyncBridge.kt | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/settings-sync/src/com/intellij/settingsSync/CloudConfigServerCommunicator.kt b/plugins/settings-sync/src/com/intellij/settingsSync/CloudConfigServerCommunicator.kt index af35d7fec62e..dac192f7ec86 100644 --- a/plugins/settings-sync/src/com/intellij/settingsSync/CloudConfigServerCommunicator.kt +++ b/plugins/settings-sync/src/com/intellij/settingsSync/CloudConfigServerCommunicator.kt @@ -49,6 +49,7 @@ private const val TIMEOUT = 10000 private fun sendSnapshotFile(inputStream: InputStream) { val currentVersion = getCurrentVersion() + LOG.info("Sending $SETTINGS_SYNC_SNAPSHOT_ZIP, current version: $currentVersion") if (currentVersion != null) { clientVersionContext.doWithVersion(SETTINGS_SYNC_SNAPSHOT_ZIP, currentVersion) { client.write(SETTINGS_SYNC_SNAPSHOT_ZIP, inputStream) @@ -125,7 +126,7 @@ private const val TIMEOUT = 10000 return SettingsSyncPushResult.Success } catch (ive: InvalidVersionIdException) { - LOG.info("Rejected: version doesn't match the version on server") + LOG.info("Rejected: version doesn't match the version on server: ${ive.message}") return SettingsSyncPushResult.Rejected } // todo handle authentication failure: propose to login diff --git a/plugins/settings-sync/src/com/intellij/settingsSync/GitSettingsLog.kt b/plugins/settings-sync/src/com/intellij/settingsSync/GitSettingsLog.kt index 8a138b264f85..e9d9b7b68b16 100644 --- a/plugins/settings-sync/src/com/intellij/settingsSync/GitSettingsLog.kt +++ b/plugins/settings-sync/src/com/intellij/settingsSync/GitSettingsLog.kt @@ -148,7 +148,7 @@ internal class GitSettingsLog(private val settingsSyncStorage: Path, private fun applySnapshotAndCommit(refName: String, snapshot: SettingsSnapshot) { // todo check repository consistency before each operation: that we're on master, that rb is deleted, that there're no uncommitted changes - LOG.info("Applying settings changes to $refName") + LOG.info("Applying settings changes to branch $refName") val addCommand = git.add() val message = "Apply changes received from $refName" for (fileState in snapshot.fileStates) { @@ -217,7 +217,7 @@ internal class GitSettingsLog(private val settingsSyncStorage: Path, private fun fastForwardMaster(branchOnSamePosition: Ref, targetBranch: Ref): BranchPosition { LOG.info("Advancing master. Its position is equal to ${branchOnSamePosition.short}: ${master.objectId.short}. " + - "Expecting fast-forward merge to ${targetBranch.short} ${targetBranch.objectId.short}") + "Fast-forwarding to ${targetBranch.short} ${targetBranch.objectId.short}") val mergeResult = git.merge().include(targetBranch).call() if (mergeResult.mergeStatus != FAST_FORWARD) { LOG.warn("Non-fast-forward result: $mergeResult") diff --git a/plugins/settings-sync/src/com/intellij/settingsSync/SettingsSyncBridge.kt b/plugins/settings-sync/src/com/intellij/settingsSync/SettingsSyncBridge.kt index af84ba8e694e..5ea1dd18313c 100644 --- a/plugins/settings-sync/src/com/intellij/settingsSync/SettingsSyncBridge.kt +++ b/plugins/settings-sync/src/com/intellij/settingsSync/SettingsSyncBridge.kt @@ -93,7 +93,7 @@ internal class SettingsSyncBridge(application: Application, if (newIdePosition != masterPosition) { // master has advanced further that ide => the ide needs to be updated val pushResult: SettingsSyncPushResult = pushToIde(settingsLog.collectCurrentSnapshot()) - LOG.info("Result of pushing settings to the cloud: $pushResult") + LOG.info("Result of pushing settings to the IDE: $pushResult") when (pushResult) { SettingsSyncPushResult.Success -> settingsLog.setIdePosition(masterPosition) is SettingsSyncPushResult.Error -> { @@ -113,6 +113,7 @@ internal class SettingsSyncBridge(application: Application, if (pushToCloudRequired || newCloudPosition != masterPosition) { val pushResult: SettingsSyncPushResult = pushToCloud(settingsLog.collectCurrentSnapshot()) + LOG.info("Result of pushing settings to the cloud: $pushResult") when (pushResult) { SettingsSyncPushResult.Success -> settingsLog.setCloudPosition(masterPosition) is SettingsSyncPushResult.Error -> {