30 lines
715 B
Markdown
30 lines
715 B
Markdown
# SmartExit - Development Hints
|
|
|
|
## Logging System
|
|
|
|
The module uses consolidated logging with a `[smartexit]` prefix:
|
|
|
|
- **Default behavior**: Logs a single summary line on shutdown
|
|
- **Silent mode**: Pass `{ silent: true }` to constructor to disable all logging
|
|
|
|
### Example output
|
|
```
|
|
[smartexit] Shutdown complete: killed 3 child processes, ran 2 cleanup functions
|
|
```
|
|
|
|
### Usage
|
|
```typescript
|
|
// Default - logs summary
|
|
const smartExit = new SmartExit();
|
|
|
|
// Silent - no logging
|
|
const smartExit = new SmartExit({ silent: true });
|
|
```
|
|
|
|
## killAll() Return Value
|
|
|
|
The `killAll()` method returns stats about the cleanup:
|
|
```typescript
|
|
const { processesKilled, cleanupFunctionsRan } = await smartExit.killAll();
|
|
```
|