UNPKG

@tanstack/ai

Version:

Core TanStack AI library - Open source AI SDK

55 lines (54 loc) 1.4 kB
import { ConsoleLogger } from "./console-logger.js"; import { InternalLogger } from "./internal-logger.js"; const ALL_OFF = { provider: false, output: false, middleware: false, tools: false, agentLoop: false, config: false, errors: false, request: false }; const ALL_ON = { provider: true, output: true, middleware: true, tools: true, agentLoop: true, config: true, errors: true, request: true }; const errorsOnlyCategories = () => ({ ...ALL_OFF, errors: true }); const resolveCategoriesFromPartial = (partial) => ({ provider: partial.provider ?? true, output: partial.output ?? true, middleware: partial.middleware ?? true, tools: partial.tools ?? true, agentLoop: partial.agentLoop ?? true, config: partial.config ?? true, errors: partial.errors ?? true, request: partial.request ?? true }); function resolveDebugOption(debug) { if (debug === void 0) { return new InternalLogger(new ConsoleLogger(), errorsOnlyCategories()); } if (debug === true) { return new InternalLogger(new ConsoleLogger(), ALL_ON); } if (debug === false) { return new InternalLogger(new ConsoleLogger(), ALL_OFF); } const { logger, ...cats } = debug; const userLogger = logger ?? new ConsoleLogger(); return new InternalLogger(userLogger, resolveCategoriesFromPartial(cats)); } export { resolveDebugOption }; //# sourceMappingURL=resolve.js.map