-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEcho.ts
More file actions
45 lines (45 loc) · 1.17 KB
/
Echo.ts
File metadata and controls
45 lines (45 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* @module Echo
*
* Echo callback function type for filtering output based on log level.
*
* The Echo function is used to control how output from child processes
* (stdout/stderr) is displayed. It provides a mechanism to filter or
* suppress output based on the current log level setting.
*
* @param Data - The output line data (trimmed whitespace)
* @param IsError - Optional boolean flag indicating if this is stderr output
* (true) or stdout output (false/undefined)
*
* @returns Promise<void>
*
* @example
* Basic usage:
* ```typescript
* const Echo = async (Data: string, IsError?: boolean): Promise<void> => {
* if (Level === "silent") {
* return;
* }
* console.log(Data);
* };
* ```
*
* @example
* Filtering by error level:
* ```typescript
* const ErrorOnlyEcho = async (Data: string, IsError?: boolean): Promise<void> => {
* if (IsError) {
* console.error(Data);
* }
* };
* ```
*
* @example
* Silencing all output:
* ```typescript
* const SilentEcho = async (): Promise<void> => {
* // Do nothing - suppress all output
* };
* ```
*/
export type Echo = (Data: string, IsError?: boolean) => Promise<void>;