Human-readable application name used in log output.
Logger instance used for all startup and lifecycle messages.
Bootstraps an application process: logs startup information, registers
handlers for SIGINT, SIGTERM, uncaughtException, and
unhandledRejection, then delegates to the optional launcher function.
The three optional parameters — launcher, monitorMemoryHours, and
defaultInterruptionHandler — have distinct types and can be supplied in
any subset and in that order, omitting whichever are not needed:
| Call | launcher | monitorMemoryHours | defaultInterruptionHandler |
|---|---|---|---|
main(name, logger) |
— | 0 | true |
main(name, logger, fn) |
fn | 0 | true |
main(name, logger, 2) |
— | 2 | true |
main(name, logger, false) |
— | 0 | false |
main(name, logger, fn, 2) |
fn | 2 | true |
main(name, logger, fn, false) |
fn | 0 | false |
main(name, logger, 2, false) |
— | 2 | false |
main(name, logger, fn, 2, false) |
fn | 2 | false |
Human-readable application name used in log output.
Logger instance used for all startup and lifecycle messages.
Bootstraps an application process: logs startup information, registers
handlers for SIGINT, SIGTERM, uncaughtException, and
unhandledRejection, then delegates to the optional launcher function.
The three optional parameters — launcher, monitorMemoryHours, and
defaultInterruptionHandler — have distinct types and can be supplied in
any subset and in that order, omitting whichever are not needed:
| Call | launcher | monitorMemoryHours | defaultInterruptionHandler |
|---|---|---|---|
main(name, logger) |
— | 0 | true |
main(name, logger, fn) |
fn | 0 | true |
main(name, logger, 2) |
— | 2 | true |
main(name, logger, false) |
— | 0 | false |
main(name, logger, fn, 2) |
fn | 2 | true |
main(name, logger, fn, false) |
fn | 0 | false |
main(name, logger, 2, false) |
— | 2 | false |
main(name, logger, fn, 2, false) |
fn | 2 | false |
Human-readable application name used in log output.
Logger instance used for all startup and lifecycle messages.
Bootstraps an application process: logs startup information, registers
handlers for SIGINT, SIGTERM, uncaughtException, and
unhandledRejection, then delegates to the optional launcher function.
The three optional parameters — launcher, monitorMemoryHours, and
defaultInterruptionHandler — have distinct types and can be supplied in
any subset and in that order, omitting whichever are not needed:
| Call | launcher | monitorMemoryHours | defaultInterruptionHandler |
|---|---|---|---|
main(name, logger) |
— | 0 | true |
main(name, logger, fn) |
fn | 0 | true |
main(name, logger, 2) |
— | 2 | true |
main(name, logger, false) |
— | 0 | false |
main(name, logger, fn, 2) |
fn | 2 | true |
main(name, logger, fn, false) |
fn | 0 | false |
main(name, logger, 2, false) |
— | 2 | false |
main(name, logger, fn, 2, false) |
fn | 2 | false |
Human-readable application name used in log output.
Logger instance used for all startup and lifecycle messages.
Bootstraps an application process: logs startup information, registers
handlers for SIGINT, SIGTERM, uncaughtException, and
unhandledRejection, then delegates to the optional launcher function.
The three optional parameters — launcher, monitorMemoryHours, and
defaultInterruptionHandler — have distinct types and can be supplied in
any subset and in that order, omitting whichever are not needed:
| Call | launcher | monitorMemoryHours | defaultInterruptionHandler |
|---|---|---|---|
main(name, logger) |
— | 0 | true |
main(name, logger, fn) |
fn | 0 | true |
main(name, logger, 2) |
— | 2 | true |
main(name, logger, false) |
— | 0 | false |
main(name, logger, fn, 2) |
fn | 2 | true |
main(name, logger, fn, false) |
fn | 0 | false |
main(name, logger, 2, false) |
— | 2 | false |
main(name, logger, fn, 2, false) |
fn | 2 | false |
Human-readable application name used in log output.
Logger instance used for all startup and lifecycle messages.
Bootstraps an application process: logs startup information, registers
handlers for SIGINT, SIGTERM, uncaughtException, and
unhandledRejection, then delegates to the optional launcher function.
The three optional parameters — launcher, monitorMemoryHours, and
defaultInterruptionHandler — have distinct types and can be supplied in
any subset and in that order, omitting whichever are not needed:
| Call | launcher | monitorMemoryHours | defaultInterruptionHandler |
|---|---|---|---|
main(name, logger) |
— | 0 | true |
main(name, logger, fn) |
fn | 0 | true |
main(name, logger, 2) |
— | 2 | true |
main(name, logger, false) |
— | 0 | false |
main(name, logger, fn, 2) |
fn | 2 | true |
main(name, logger, fn, false) |
fn | 0 | false |
main(name, logger, 2, false) |
— | 2 | false |
main(name, logger, fn, 2, false) |
fn | 2 | false |
Human-readable application name used in log output.
Logger instance used for all startup and lifecycle messages.
Bootstraps an application process: logs startup information, registers
handlers for SIGINT, SIGTERM, uncaughtException, and
unhandledRejection, then delegates to the optional launcher function.
The three optional parameters — launcher, monitorMemoryHours, and
defaultInterruptionHandler — have distinct types and can be supplied in
any subset and in that order, omitting whichever are not needed:
| Call | launcher | monitorMemoryHours | defaultInterruptionHandler |
|---|---|---|---|
main(name, logger) |
— | 0 | true |
main(name, logger, fn) |
fn | 0 | true |
main(name, logger, 2) |
— | 2 | true |
main(name, logger, false) |
— | 0 | false |
main(name, logger, fn, 2) |
fn | 2 | true |
main(name, logger, fn, false) |
fn | 0 | false |
main(name, logger, 2, false) |
— | 2 | false |
main(name, logger, fn, 2, false) |
fn | 2 | false |
Human-readable application name used in log output.
Logger instance used for all startup and lifecycle messages.
Human-readable application name used in log output.
Logger instance used for all startup and lifecycle messages.
Optional function invoked after all process handlers are registered. Use a closure to capture any context needed (e.g. a logger).
When greater than 0, starts periodic memory
logging every monitorMemoryHours hours via monitorMemory.
Defaults to 0 (disabled).
When true (default), registers SIGINT
and SIGTERM handlers that log and exit cleanly. Set to false when the
application manages its own graceful shutdown (e.g. closing servers or
database connections).
Bootstraps an application process: logs startup information, registers handlers for
SIGINT,SIGTERM,uncaughtException, andunhandledRejection, then delegates to the optional launcher function.The three optional parameters —
launcher,monitorMemoryHours, anddefaultInterruptionHandler— have distinct types and can be supplied in any subset and in that order, omitting whichever are not needed:main(name, logger)main(name, logger, fn)main(name, logger, 2)main(name, logger, false)main(name, logger, fn, 2)main(name, logger, fn, false)main(name, logger, 2, false)main(name, logger, fn, 2, false)