Skip to content

Commit

Permalink
Move logging responsibility as a step to making the express app a Layer
Browse files Browse the repository at this point in the history
Refs: #1834
  • Loading branch information
erkannt committed Aug 28, 2024
1 parent 8f6b150 commit e69698b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ const server = http.createServer(
}),
)

server.on('listening', () => {
L.debug('Server listening')(loggerEnv)()
})

NodeRuntime.runMain(
Layer.launch(
Layer.scopedDiscard(
Effect.acquireRelease(
Effect.sync(() => server.listen(3000)),
Effect.sync(() => {
const listeningHttpServer = server.listen(3000)
L.debug('Server listening')(loggerEnv)()
return listeningHttpServer
}),
server =>
Effect.promise(async () => {
L.debug('Shutting server down')(loggerEnv)()
Expand Down

0 comments on commit e69698b

Please sign in to comment.