| 23 | import type { ShardingConfig } from "./ShardingConfig.ts" |
| 24 | |
| 25 | const withLogAddress = <A, E, R>(layer: Layer.Layer<A, E, R>): Layer.Layer<A, E, R | SocketServer> => |
| 26 | Layer.effectDiscard(Effect.gen(function*() { |
| 27 | const server = yield* SocketServer |
| 28 | const address = server.address._tag === "UnixAddress" |
| 29 | ? server.address.path |
| 30 | : `${server.address.hostname}:${server.address.port}` |
| 31 | yield* Effect.annotateLogs(Effect.logInfo(`Listening on: ${address}`), { |
| 32 | package: "@effect/cluster", |
| 33 | service: "Runner" |
| 34 | }) |
| 35 | })).pipe(Layer.provideMerge(layer)) |
| 36 | |
| 37 | /** |
| 38 | * Layer that runs a cluster runner over the socket RPC protocol, providing |