Skip to content

Commit 545ba8b

Browse files
committed
fix
1 parent 484f0bc commit 545ba8b

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/addons/consoleCatcher.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
import type { ConsoleLogEvent } from '@hawk.so/types';
66

7-
/**
8-
* Factory function to create a console log catcher
9-
* @returns Object with methods for initializing, retrieving, and adding console logs
10-
*/
117
const createConsoleCatcher = (): {
128
initConsoleCatcher: () => void;
139
addErrorEvent: (event: ErrorEvent | PromiseRejectionEvent) => void;
@@ -17,22 +13,13 @@ const createConsoleCatcher = (): {
1713
const consoleOutput: ConsoleLogEvent[] = [];
1814
let isInitialized = false;
1915

20-
/**
21-
* Adds a log event to the console output buffer
22-
* @param logEvent - The log event to store
23-
*/
2416
const addToConsoleOutput = (logEvent: ConsoleLogEvent): void => {
2517
if (consoleOutput.length >= MAX_LOGS) {
2618
consoleOutput.shift();
2719
}
2820
consoleOutput.push(logEvent);
2921
};
3022

31-
/**
32-
* Creates a ConsoleLogEvent from an ErrorEvent or PromiseRejectionEvent
33-
* @param event - The event to process
34-
* @returns The formatted log event
35-
*/
3623
const createConsoleEventFromError = (
3724
event: ErrorEvent | PromiseRejectionEvent
3825
): ConsoleLogEvent => {
@@ -60,9 +47,6 @@ const createConsoleCatcher = (): {
6047
};
6148

6249
return {
63-
/**
64-
* Initializes the console catcher by overriding console methods
65-
*/
6650
initConsoleCatcher(): void {
6751
if (isInitialized) {
6852
return;
@@ -98,19 +82,11 @@ const createConsoleCatcher = (): {
9882
});
9983
},
10084

101-
/**
102-
* Adds an error event (either an ErrorEvent or a PromiseRejectionEvent) to the log stack
103-
* @param event - The error event to log
104-
*/
10585
addErrorEvent(event: ErrorEvent | PromiseRejectionEvent): void {
10686
const logEvent = createConsoleEventFromError(event);
10787
addToConsoleOutput(logEvent);
10888
},
10989

110-
/**
111-
* Retrieves the current console log stack
112-
* @returns A copy of the console log stack
113-
*/
11490
getConsoleLogStack(): ConsoleLogEvent[] {
11591
return [ ...consoleOutput ];
11692
},

0 commit comments

Comments
 (0)