refactor(core): replace legacy logger with Effect logging (#31310)

This commit is contained in:
Dax
2026-06-08 15:41:56 -04:00
committed by GitHub
parent 0a7cb20e66
commit c06ad7c881
152 changed files with 698 additions and 2243 deletions
+6 -7
View File
@@ -5,7 +5,6 @@ import { SessionID, MessageID, PartID } from "./schema"
import { Provider } from "@/provider/provider"
import { MessageV2 } from "./message-v2"
import { Token } from "@/util/token"
import { Log } from "@opencode-ai/core/util/log"
import { SessionProcessor } from "./processor"
import { Agent } from "@/agent/agent"
import { Plugin } from "@/plugin"
@@ -26,8 +25,6 @@ import { ModelV2 } from "@opencode-ai/core/model"
import { EventV2 } from "@opencode-ai/core/event"
import { buildPrompt } from "@opencode-ai/core/session/compaction"
const log = Log.create({ service: "session.compaction" })
export const Event = {
Compacted: EventV2.define({
type: "session.compacted",
@@ -237,7 +234,9 @@ export const layer = Layer.effect(
estimate,
})
if (split) keep = split
else if (!keep) log.info("tail fallback", { budget, size, total })
else if (!keep) {
yield* Effect.logInfo("tail fallback", { budget, size, total })
}
break
}
@@ -253,7 +252,7 @@ export const layer = Layer.effect(
const prune = Effect.fn("SessionCompaction.prune")(function* (input: { sessionID: SessionID }) {
const cfg = yield* config.get()
if (!cfg.compaction?.prune) return
log.info("pruning")
yield* Effect.logInfo("pruning")
const msgs = yield* session
.messages({ sessionID: input.sessionID })
@@ -284,7 +283,7 @@ export const layer = Layer.effect(
}
}
log.info("found", { pruned, total })
yield* Effect.logInfo("found", { pruned, total })
if (pruned > PRUNE_MINIMUM) {
for (const part of toPrune) {
if (part.state.status === "completed") {
@@ -292,7 +291,7 @@ export const layer = Layer.effect(
yield* session.updatePart(part)
}
}
log.info("pruned", { count: toPrune.length })
yield* Effect.logInfo("pruned", { count: toPrune.length })
}
})