MCPcopy Create free account
hub / github.com/anus-dev/ANUS / useLogger

Function useLogger

packages/cli/src/ui/hooks/useLogger.ts:14–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12 * Hook to manage the logger instance.
13 */
14export const useLogger = () => {
15 const [logger, setLogger] = useState<Logger | null>(null);
16
17 useEffect(() => {
18 const newLogger = new Logger(sessionId);
19 /**
20 * Start async initialization, no need to await. Using await slows down the
21 * time from launch to see the anus-cli prompt and it's better to not save
22 * messages than for the cli to hanging waiting for the logger to loading.
23 */
24 newLogger
25 .initialize()
26 .then(() => {
27 setLogger(newLogger);
28 })
29 .catch(() => {});
30 }, []);
31
32 return logger;
33};

Callers 2

AppFunction · 0.85
useAnusStreamFunction · 0.85

Calls 1

initializeMethod · 0.95

Tested by

no test coverage detected