feat(smartexit): Add silent logging option, structured shutdown logs, and killAll return stats

This commit is contained in:
2025-12-15 16:58:01 +00:00
parent 4ce60859e4
commit bb2831ec0f
4 changed files with 100 additions and 36 deletions

View File

@@ -1 +1,29 @@
# 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();
```