Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,20 @@ class AgentSessionsLogger extends Disposable {
private registerListeners(): void {
this._register(this.logService.onDidChangeLogLevel(level => {
if (level === LogLevel.Trace) {
this.logIfTrace('Log level changed to trace');
this.logAllStatsIfTrace('Log level changed to trace');
}
}));
}

logIfTrace(reason: string): void {
logIfTrace(msg: string): void {
if (this.logService.getLevel() !== LogLevel.Trace) {
return;
}

this.trace(`[Agent Sessions] ${msg}`);
}

logAllStatsIfTrace(reason: string): void {
if (this.logService.getLevel() !== LogLevel.Trace) {
return;
}
Expand All @@ -249,11 +257,6 @@ class AgentSessionsLogger extends Disposable {
}

private logAllSessions(reason: string): void {
const channel = this.outputService.getChannel(agentSessionsOutputChannelId);
if (!channel) {
return;
}

const { sessions, sessionStates } = this.getSessionsData();

const lines: string[] = [];
Expand Down Expand Up @@ -316,15 +319,10 @@ class AgentSessionsLogger extends Disposable {

lines.push(`=== End Agent Sessions ===`);

channel.append(lines.join('\n') + '\n');
this.trace(lines.join('\n'));
}

private logSessionStates(): void {
const channel = this.outputService.getChannel(agentSessionsOutputChannelId);
if (!channel) {
return;
}

const { sessionStates } = this.getSessionsData();

const lines: string[] = [];
Expand All @@ -341,15 +339,10 @@ class AgentSessionsLogger extends Disposable {

lines.push(`=== End Session States ===`);

channel.append(lines.join('\n') + '\n');
this.trace(lines.join('\n'));
}

private logMapSessionToState(): void {
const channel = this.outputService.getChannel(agentSessionsOutputChannelId);
if (!channel) {
return;
}

const { mapSessionToState } = this.getSessionsData();

const lines: string[] = [];
Expand All @@ -367,7 +360,16 @@ class AgentSessionsLogger extends Disposable {

lines.push(`=== End Map Session To State ===`);

channel.append(lines.join('\n') + '\n');
this.trace(lines.join('\n'));
}

private trace(msg: string): void {
const channel = this.outputService.getChannel(agentSessionsOutputChannelId);
if (!channel) {
return;
}

channel.append(`${msg}\n`);
}
}

Expand Down Expand Up @@ -425,7 +427,7 @@ export class AgentSessionsModel extends Disposable implements IAgentSessionsMode
mapSessionToState: this.mapSessionToState
})
));
this.logger.logIfTrace('Loaded cached sessions');
this.logger.logAllStatsIfTrace('Loaded cached sessions');

this.registerListeners();

Expand Down Expand Up @@ -618,7 +620,7 @@ export class AgentSessionsModel extends Disposable implements IAgentSessionsMode
}
}

this.logger.logIfTrace('Sessions resolved from providers');
this.logger.logAllStatsIfTrace('Sessions resolved from providers');

this._onDidChangeSessions.fire();
}
Expand Down
Loading