Skip to content

Commit 45ab95f

Browse files
committed
Adds/fixes logging
1 parent 3270cad commit 45ab95f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/plus/focus/focusService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class FocusService implements Disposable {
9999
return this.get('snooze');
100100
}
101101

102-
@log()
102+
@log<FocusService['pinItem']>({ args: { 0: i => `${i.id} (${i.remote.provider.name} ${i.type})` } })
103103
async pinItem(item: FocusItem): Promise<EnrichedItem> {
104104
const scope = getLogScope();
105105

@@ -138,7 +138,7 @@ export class FocusService implements Disposable {
138138
return this.delete(id, 'unpin');
139139
}
140140

141-
@log()
141+
@log<FocusService['snoozeItem']>({ args: { 0: i => `${i.id} (${i.remote.provider.name} ${i.type})` } })
142142
async snoozeItem(item: FocusItem): Promise<EnrichedItem> {
143143
const scope = getLogScope();
144144

src/plus/webviews/focus/focusWebview.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { getWorktreeForBranch } from '../../../git/models/worktree';
2424
import { parseGitRemoteUrl } from '../../../git/parsers/remoteParser';
2525
import type { RichRemoteProvider } from '../../../git/remotes/richRemoteProvider';
2626
import { executeCommand, registerCommand } from '../../../system/command';
27+
import { debug } from '../../../system/decorators/log';
2728
import { getSettledValue } from '../../../system/promise';
2829
import type { IpcMessage } from '../../../webviews/protocol';
2930
import { onIpc } from '../../../webviews/protocol';
@@ -129,6 +130,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
129130
}
130131
}
131132

133+
@debug({ args: false })
132134
private async onPinIssue({ issue, pin }: PinIssueParams) {
133135
const issueWithRemote = this._issues?.find(r => r.issue.nodeId === issue.nodeId);
134136
if (issueWithRemote == null) return;
@@ -159,6 +161,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
159161
void this.notifyDidChangeState();
160162
}
161163

164+
@debug({ args: false })
162165
private async onSnoozeIssue({ issue, snooze }: SnoozeIssueParams) {
163166
const issueWithRemote = this._issues?.find(r => r.issue.nodeId === issue.nodeId);
164167
if (issueWithRemote == null) return;
@@ -189,6 +192,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
189192
void this.notifyDidChangeState();
190193
}
191194

195+
@debug({ args: false })
192196
private async onPinPr({ pullRequest, pin }: PinPrParams) {
193197
const prWithRemote = this._pullRequests?.find(r => r.pullRequest.nodeId === pullRequest.nodeId);
194198
if (prWithRemote == null) return;
@@ -219,6 +223,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
219223
void this.notifyDidChangeState();
220224
}
221225

226+
@debug({ args: false })
222227
private async onSnoozePr({ pullRequest, snooze }: SnoozePrParams) {
223228
const prWithRemote = this._pullRequests?.find(r => r.pullRequest.nodeId === pullRequest.nodeId);
224229
if (prWithRemote == null) return;
@@ -323,6 +328,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
323328
};
324329
}
325330

331+
@debug({ args: false })
326332
private async onOpenBranch({ pullRequest }: OpenBranchParams) {
327333
const prWithRemote = this.findSearchedPullRequest(pullRequest);
328334
if (prWithRemote == null) return;
@@ -338,6 +344,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
338344
void executeCommand<ShowInCommitGraphCommandArgs>(Commands.ShowInCommitGraph, { ref: remoteBranch.reference });
339345
}
340346

347+
@debug({ args: false })
341348
private async onSwitchBranch({ pullRequest }: SwitchToBranchParams) {
342349
const prWithRemote = this.findSearchedPullRequest(pullRequest);
343350
if (prWithRemote == null || prWithRemote.isCurrentBranch) return;
@@ -357,6 +364,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
357364
return RepoActions.switchTo(remoteBranch.remote.repoPath, remoteBranch.reference);
358365
}
359366

367+
@debug({ args: false })
360368
private async onOpenWorktree({ pullRequest }: OpenWorktreeParams) {
361369
const searchedPullRequestWithRemote = this.findSearchedPullRequest(pullRequest);
362370
if (searchedPullRequestWithRemote?.repoAndRemote == null) {
@@ -400,13 +408,15 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
400408
}
401409

402410
private _access: FeatureAccess | RepoFeatureAccess | undefined;
411+
@debug()
403412
private async getAccess(force?: boolean) {
404413
if (force || this._access == null) {
405414
this._access = await this.container.git.access(PlusFeatures.Focus);
406415
}
407416
return this._access;
408417
}
409418

419+
@debug()
410420
private async getState(force?: boolean, deferState?: boolean): Promise<State> {
411421
const webviewId = this.host.id;
412422

@@ -489,6 +499,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
489499
return this.getState(true, true);
490500
}
491501

502+
@debug()
492503
private async getRichRepos(force?: boolean): Promise<RepoWithRichRemote[]> {
493504
if (force || this._repos == null) {
494505
const repos = [];
@@ -525,6 +536,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
525536
}
526537
}
527538

539+
@debug({ args: { 0: false } })
528540
private async getMyPullRequests(
529541
richRepos: RepoWithRichRemote[],
530542
force?: boolean,
@@ -587,6 +599,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
587599
return this._pullRequests;
588600
}
589601

602+
@debug({ args: { 0: false } })
590603
private async getMyIssues(richRepos: RepoWithRichRemote[], force?: boolean): Promise<SearchedIssueWithRank[]> {
591604
if (force || this._pullRequests == null) {
592605
const allIssues = [];
@@ -625,6 +638,7 @@ export class FocusWebviewProvider implements WebviewProvider<State> {
625638
return this._issues;
626639
}
627640

641+
@debug()
628642
private async getEnrichedItems(force?: boolean): Promise<EnrichedItem[] | undefined> {
629643
// TODO needs cache invalidation
630644
if (force || this._enrichedItems == null) {

0 commit comments

Comments
 (0)