Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

Logger.md

122 lines2.9 KB

1---
2id: Logger
3title: Logger
4---
5​
6# Interface: Logger
7​
8Defined in: [packages/typescript/ai/src/logger/types.ts:4](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/logger/types.ts#L4)
9​
10Pluggable logger interface consumed by every `@tanstack/ai` activity when `debug` is enabled. Supply a custom implementation via `debug: { logger }` on `chat()`, `summarize()`, `generateImage()`, etc. The four methods correspond to log levels: use `debug` for chunk-level diagnostic output, `info`/`warn` for notable events, `error` for caught exceptions.
11​
12## Properties
13​
14### debug()
15​
16```ts
17debug: (message, meta?) => void;
18```
19​
20Defined in: [packages/typescript/ai/src/logger/types.ts:9](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/logger/types.ts#L9)
21​
22Called for chunk-level diagnostic output (raw provider chunks, per-chunk output, agent-loop iteration markers).
23​
24#### Parameters
25​
26##### message
27​
28`string`
29​
30##### meta?
31​
32`Record`\<`string`, `unknown`\>
33​
34Structured data forwarded to the underlying logger. Loggers like pino will preserve this as a structured record; console-based loggers pass it as the second argument to `console.<level>`.
35​
36#### Returns
37​
38`void`
39​
40***
41​
42### error()
43​
44```ts
45error: (message, meta?) => void;
46```
47​
48Defined in: [packages/typescript/ai/src/logger/types.ts:24](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/logger/types.ts#L24)
49​
50Called for caught exceptions throughout the pipeline.
51​
52#### Parameters
53​
54##### message
55​
56`string`
57​
58##### meta?
59​
60`Record`\<`string`, `unknown`\>
61​
62Structured data forwarded to the underlying logger. Loggers like pino will preserve this as a structured record; console-based loggers pass it as the second argument to `console.<level>`.
63​
64#### Returns
65​
66`void`
67​
68***
69​
70### info()
71​
72```ts
73info: (message, meta?) => void;
74```
75​
76Defined in: [packages/typescript/ai/src/logger/types.ts:14](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/logger/types.ts#L14)
77​
78Called for notable informational events (outgoing requests, tool invocations, middleware transitions).
79​
80#### Parameters
81​
82##### message
83​
84`string`
85​
86##### meta?
87​
88`Record`\<`string`, `unknown`\>
89​
90Structured data forwarded to the underlying logger. Loggers like pino will preserve this as a structured record; console-based loggers pass it as the second argument to `console.<level>`.
91​
92#### Returns
93​
94`void`
95​
96***
97​
98### warn()
99​
100```ts
101warn: (message, meta?) => void;
102```
103​
104Defined in: [packages/typescript/ai/src/logger/types.ts:19](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/logger/types.ts#L19)
105​
106Called for notable warnings that don't halt execution (deprecations, recoverable anomalies).
107​
108#### Parameters
109​
110##### message
111​
112`string`
113​
114##### meta?
115​
116`Record`\<`string`, `unknown`\>
117​
118Structured data forwarded to the underlying logger. Loggers like pino will preserve this as a structured record; console-based loggers pass it as the second argument to `console.<level>`.
119​
120#### Returns
121​
122`void`