refactor(core): replace legacy logger with Effect logging (#31310)
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
import { GlobalBus } from "@/bus/global"
|
||||
import { InstanceStore } from "@/project/instance-store"
|
||||
import * as Log from "@opencode-ai/core/util/log"
|
||||
import { Effect } from "effect"
|
||||
import { Event } from "./event"
|
||||
|
||||
const log = Log.create({ service: "server" })
|
||||
|
||||
export const emitGlobalDisposed = Effect.sync(() =>
|
||||
GlobalBus.emit("event", {
|
||||
directory: "global",
|
||||
@@ -21,13 +18,7 @@ export const disposeAllInstancesAndEmitGlobalDisposed = Effect.fn("Server.dispos
|
||||
const store = yield* InstanceStore.Service
|
||||
yield* Effect.gen(function* () {
|
||||
yield* options?.swallowErrors
|
||||
? store.disposeAll().pipe(
|
||||
Effect.catchCause((cause) =>
|
||||
Effect.sync(() => {
|
||||
log.warn("global disposal failed", { cause })
|
||||
}),
|
||||
),
|
||||
)
|
||||
? store.disposeAll().pipe(Effect.catchCause((cause) => Effect.logWarning("global disposal failed", { cause })))
|
||||
: store.disposeAll()
|
||||
yield* emitGlobalDisposed
|
||||
}).pipe(Effect.uninterruptible)
|
||||
|
||||
Reference in New Issue
Block a user