enable logs; add sentry logging to block runs (debugger) (#3205)
This commit is contained in:
26
skyvern-frontend/src/store/LoggingContext.ts
Normal file
26
skyvern-frontend/src/store/LoggingContext.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { createContext } from "react";
|
||||
|
||||
type LogFn = (message: string, data?: Record<string, unknown>) => void;
|
||||
|
||||
interface Logging {
|
||||
info: LogFn;
|
||||
warn: LogFn;
|
||||
error: LogFn;
|
||||
}
|
||||
|
||||
// make this a stub of LogFn that does nothing
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const noop: LogFn = (..._: Parameters<LogFn>) => {};
|
||||
|
||||
const stub: Logging = {
|
||||
info: noop,
|
||||
warn: noop,
|
||||
error: noop,
|
||||
};
|
||||
|
||||
type GetLogging = () => Logging;
|
||||
|
||||
const LoggingContext = createContext<GetLogging>(() => stub);
|
||||
|
||||
export { LoggingContext, stub as loggingStub };
|
||||
Reference in New Issue
Block a user