Skip to content

Commit 084b175

Browse files
authored
fix: Remove noisy SessionLogWriter info logs (#1109)
1 parent 21fae33 commit 084b175

1 file changed

Lines changed: 1 addition & 36 deletions

File tree

packages/agent/src/session-log-writer.ts

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class SessionLogWriter {
3737
private lastFlushAttemptTime: Map<string, number> = new Map();
3838
private retryCounts: Map<string, number> = new Map();
3939
private sessions: Map<string, SessionState> = new Map();
40-
private messageCounts: Map<string, number> = new Map();
40+
4141
private logger: Logger;
4242
private localCachePath?: string;
4343

@@ -51,20 +51,6 @@ export class SessionLogWriter {
5151

5252
async flushAll(): Promise<void> {
5353
const sessionIds = [...this.sessions.keys()];
54-
const pendingCounts = sessionIds.map((id) => {
55-
const session = this.sessions.get(id);
56-
return {
57-
taskId: session?.context.taskId,
58-
runId: session?.context.runId,
59-
pending: this.pendingEntries.get(id)?.length ?? 0,
60-
messages: this.messageCounts.get(id) ?? 0,
61-
};
62-
});
63-
this.logger.info("flushAll called", {
64-
sessions: sessionIds.length,
65-
pending: pendingCounts,
66-
});
67-
6854
const flushPromises: Promise<void>[] = [];
6955
for (const sessionId of sessionIds) {
7056
flushPromises.push(this.flush(sessionId));
@@ -115,16 +101,6 @@ export class SessionLogWriter {
115101
return;
116102
}
117103

118-
const count = (this.messageCounts.get(sessionId) ?? 0) + 1;
119-
this.messageCounts.set(sessionId, count);
120-
if (count % 10 === 1) {
121-
this.logger.info("Messages received", {
122-
count,
123-
taskId: session.context.taskId,
124-
runId: session.context.runId,
125-
});
126-
}
127-
128104
try {
129105
const message = JSON.parse(line);
130106
const timestamp = new Date().toISOString();
@@ -186,12 +162,6 @@ export class SessionLogWriter {
186162

187163
const pending = this.pendingEntries.get(sessionId);
188164
if (!this.posthogAPI || !pending?.length) {
189-
this.logger.info("flush: nothing to persist", {
190-
taskId: session.context.taskId,
191-
runId: session.context.runId,
192-
hasPosthogAPI: !!this.posthogAPI,
193-
pendingCount: pending?.length ?? 0,
194-
});
195165
return;
196166
}
197167

@@ -211,11 +181,6 @@ export class SessionLogWriter {
211181
pending,
212182
);
213183
this.retryCounts.set(sessionId, 0);
214-
this.logger.info("Flushed session logs", {
215-
taskId: session.context.taskId,
216-
runId: session.context.runId,
217-
entryCount: pending.length,
218-
});
219184
} catch (error) {
220185
const retryCount = (this.retryCounts.get(sessionId) ?? 0) + 1;
221186
this.retryCounts.set(sessionId, retryCount);

0 commit comments

Comments
 (0)