Class: JSONLogStream
Defined in: logging/json-log-stream.ts:20
A LogStream implementation that writes log entries to a JSON file. Supports optional throttling to reduce the number of entries written.
Implements
Constructors
Constructor
new JSONLogStream(
path,throttleRate?):JSONLogStream
Defined in: logging/json-log-stream.ts:31
Creates a new JSONLogStream
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
path | string | undefined | Path to the JSON log file |
throttleRate | number | 1 | Optional throttling rate - only 1/throttleRate entries will be written. Default is 1 (no throttling). |
Returns
JSONLogStream
Properties
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
path | readonly | string | undefined | Path to the JSON log file | logging/json-log-stream.ts:31 |
throttleRate | readonly | number | 1 | Optional throttling rate - only 1/throttleRate entries will be written. Default is 1 (no throttling). | logging/json-log-stream.ts:31 |
Methods
appendEntry()
appendEntry(
e):Promise<void>
Defined in: logging/json-log-stream.ts:44
Appends a log entry to the JSON file, respecting the throttle rate
Parameters
| Parameter | Type | Description |
|---|---|---|
e | NormalizedLogEntry<LogEntry> | The normalized log entry to append |
Returns
Promise<void>
Implementation of
close()
close():
Promise<void>
Defined in: logging/json-log-stream.ts:63
Closes the JSON log file if it's open. This is handled automatically by the stream and there's no need to call it explicitly under normal operation.
You may want to call this explicitly when:
- You need to ensure logs are flushed to disk immediately
- You're shutting down the application and want to clean up resources
- You want to release the file handle before the automatic timeout
Returns
Promise<void>