Documents injecute 1.x · Migrating from 0.x
Skip to content

Interface: LifecycleHookEvent ​

Defined in: src/utils/lifecycle.ts:143

What onHook receives after each hook ran or was undone.

Example ​

ts
await startLifecycle(app, {
  onHook: ({ key, action, ms, error }: LifecycleHookEvent) =>
    logger.info({ key, action, ms, failed: error !== undefined }),
});

Properties ​

action ​

readonly action: "start" | "undo"

Defined in: src/utils/lifecycle.ts:149

start: the hook ran (at startup); undo: its undo function ran (at stop or rollback).


error? ​

readonly optional error?: unknown

Defined in: src/utils/lifecycle.ts:153

Why it failed or didn't finish; missing when it succeeded.


key ​

readonly key: ServiceKey

Defined in: src/utils/lifecycle.ts:145

The hook's key, e.g. 'Payments.consumer:start'.


ms ​

readonly ms: number

Defined in: src/utils/lifecycle.ts:151

How long it took, in milliseconds.


stage ​

readonly stage: string

Defined in: src/utils/lifecycle.ts:147

The hook's stage.

Released under the MIT License.