Skip to content

Commit

Permalink
Log the server lifecycle
Browse files Browse the repository at this point in the history
Refs #1834
  • Loading branch information
thewilkybarkid committed Sep 12, 2024
1 parent 5fbf437 commit 1cdb8e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,15 @@ const annotateLogsWithRequestId = HttpMiddleware.make(app =>
),
)

const logStopped = Layer.scopedDiscard(Effect.addFinalizer(() => Effect.logInfo('Server stopped')))

export const Program = pipe(
Router,
Effect.catchTag('RouteNotFound', () => ExpressHttpApp),
addSecurityHeaders,
addXRobotsTagHeader,
HttpServer.serve(annotateLogsWithRequestId),
HttpServer.withLogAddress,
Layer.provide(logStopped),
Layer.provide(Layer.effect(Express, expressServer)),
)

0 comments on commit 1cdb8e1

Please sign in to comment.