feat(smartexit): Add silent logging option, structured shutdown logs, and killAll return stats
This commit is contained in:
@@ -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();
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user