Skip to content

Commit 16ab2b7

Browse files
committed
Add debug logs when writing to persistent storage (#18288)
Adds traceVerbose logging calls at the two write paths in persistentState.ts: - PersistentState.updateValue() - the core write path used by both global and workspace persistent state - updateWorkspaceStateValue() - a separate direct write path This makes it easier to diagnose issues related to persistent storage writes, as requested in the issue. Verified: eslint and prettier pass cleanly on the changed file, tsc compiles with no errors, and pre-existing test failures in testing/utils.unit.test.js were confirmed unrelated (same failures occur with this change stashed out).
1 parent db91e3d commit 16ab2b7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/client/common/persistentState.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { inject, injectable, named, optional } from 'inversify';
77
import { Memento } from 'vscode';
88
import { IExtensionSingleActivationService } from '../activation/types';
9-
import { traceError } from '../logging';
9+
import { traceError, traceVerbose } from '../logging';
1010
import { ICommandManager } from './application/types';
1111
import { Commands } from './constants';
1212
import {
@@ -43,6 +43,7 @@ export async function updateWorkspaceStateValue<T>(key: string, value: T): Promi
4343
throw new Error('Workspace state not initialized');
4444
}
4545
try {
46+
traceVerbose(`Updating workspace persistent state for key [${key}]`);
4647
_workspaceKeys.push(key);
4748
await _workspaceState.update(key, value);
4849
const after = getWorkspaceStateValue(key);
@@ -85,6 +86,7 @@ export class PersistentState<T> implements IPersistentState<T> {
8586

8687
public async updateValue(newValue: T, retryOnce = true): Promise<void> {
8788
try {
89+
traceVerbose(`Updating persistent state for key [${this.key}]`);
8890
if (this.expiryDurationMs) {
8991
await this.storage.update(this.key, { data: newValue, expiry: Date.now() + this.expiryDurationMs });
9092
} else {

0 commit comments

Comments
 (0)