<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/one-flag-every-chunk-debug-logging-lands-in-tanstack-ai-a8rybvwmo" -->

---
title: One Flag, Every Chunk: Debug Logging Lands in TanStack AI
description: TanStack AI now ships built-in, pluggable debug logging across every activity (chat, summarize, generateImage, generateSpeech, generateTranscription,...
canonical: https://daily.dev/posts/one-flag-every-chunk-debug-logging-lands-in-tanstack-ai-a8rybvwmo
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: One Flag, Every Chunk: Debug Logging Lands in TanStack AI | daily.dev
og:description: TanStack AI now ships built-in, pluggable debug logging across every activity (chat, summarize, generateImage, generateSpeech, generateTranscription,...
og:url: https://daily.dev/posts/one-flag-every-chunk-debug-logging-lands-in-tanstack-ai-a8rybvwmo
og:image: https://api.daily.dev/og/posts/a8RYBvwmo.png
og:image:alt: One Flag, Every Chunk: Debug Logging Lands in TanStack AI
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# One Flag, Every Chunk: Debug Logging Lands in TanStack AI

**[TanStack](https://daily.dev/sources/tanstack-blog)** · 6 min read · 0 upvotes · 0 comments

## Summary

TanStack AI now ships built-in, pluggable debug logging across every activity (chat, summarize, generateImage, generateSpeech, generateTranscription, generateVideo) and all 25 provider adapters. Adding debug: true prints every internal event with category tags (request, provider, output, middleware, tools, agentLoop, config, errors), each independently toggleable. Users can swap in a custom Logger (Pino, Winston, etc.) for structured production logging; internal try/catch wrapping ensures a broken logger never masks the real pipeline error. Errors log unconditionally by default, devtools middleware is muted from the middleware category, and console.dir with depth: null prevents nested objects from being truncated. The feature is additive and backward-compatible in the latest @tanstack/ai release.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tanstack.com/blog/debug-logging-for-tanstack-ai>

## Questions this post answers

### How do I enable debug logging in TanStack AI's chat function?

Add debug: true to the activity call, such as chat({ adapter, model, messages, debug: true }). This prints every internal pipeline event to the console, prefixed with an emoji-tagged category like request, provider, output, middleware, tools, agentLoop, config, and errors, so you can see exactly what each layer of the pipeline is doing without wiring up OpenTelemetry or a tracing platform.

_Developers debugging AI pipelines can find hands-on breakdowns of features like this on daily.dev._

### How can I send TanStack AI debug logs to a structured logger like Pino instead of the console?

Pass a custom Logger object through the debug config, for example debug: { logger }, where logger implements four methods: debug, info, warn, and error. Any logger that writes a line of text works, including Pino, Winston, or Bunyan. Internally every logger call is wrapped in a try/catch, so a broken logger silently drops the log line instead of masking the real pipeline error.

_Teams choosing logging setups for production AI pipelines track details like this on daily.dev._

### Which AI provider adapters support debug logging in TanStack AI?

All 25 adapters across every provider package are wired through the structured logger, including OpenAI, Anthropic, Gemini, Grok, Groq, Ollama, OpenRouter, fal, and ElevenLabs, covering both text and realtime session adapters. Zero ad-hoc console.* calls remain in adapter source code, so the debug output shape is consistent whether debugging an Anthropic text stream or an ElevenLabs realtime session.

_Anyone comparing AI provider integrations can keep track of ecosystem updates like this via daily.dev._

## Similar posts on daily.dev

- [TanStack Releases Framework Agnostic AI Toolkit](https://daily.dev/posts/tanstack-releases-framework-agnostic-ai-toolkit-j747yitl6) · InfoQ · 1 upvotes · 0 comments
- [We taught ClickStack to read your logs like a detective novel](https://daily.dev/posts/we-taught-clickstack-to-read-your-logs-like-a-detective-novel-vbfjdqzlq) · ClickHouse · 0 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#typescript](https://daily.dev/tags/typescript), [#observability](https://daily.dev/tags/observability)

[View this post on daily.dev](https://daily.dev/posts/one-flag-every-chunk-debug-logging-lands-in-tanstack-ai-a8rybvwmo)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"One Flag, Every Chunk: Debug Logging Lands in TanStack AI","url":"https://daily.dev/posts/one-flag-every-chunk-debug-logging-lands-in-tanstack-ai-a8rybvwmo","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/one-flag-every-chunk-debug-logging-lands-in-tanstack-ai-a8rybvwmo"},"datePublished":"2026-08-23T12:23:56.254Z","dateModified":"2026-08-23T12:53:16.434Z","description":"TanStack AI now ships built-in, pluggable debug logging across every activity (chat, summarize, generateImage, generateSpeech, generateTranscription,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3f9ce770053ccaccf0f7685d3436f7d2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3f9ce770053ccaccf0f7685d3436f7d2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"TanStack","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"TanStack","logo":"https://media.daily.dev/image/upload/s--TVIrvIT7--/f_auto,q_auto/v1787487634/logos/tanstack-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/tanstack-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/one-flag-every-chunk-debug-logging-lands-in-tanstack-ai-a8rybvwmo","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,typescript,observability","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"TanStack","item":"https://daily.dev/sources/tanstack-blog"},{"@type":"ListItem","position":3,"name":"One Flag, Every Chunk: Debug Logging Lands in TanStack AI"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/one-flag-every-chunk-debug-logging-lands-in-tanstack-ai-a8rybvwmo#faq","mainEntity":[{"@type":"Question","name":"How do I enable debug logging in TanStack AI's chat function?","acceptedAnswer":{"@type":"Answer","text":"Add debug: true to the activity call, such as chat({ adapter, model, messages, debug: true }). This prints every internal pipeline event to the console, prefixed with an emoji-tagged category like request, provider, output, middleware, tools, agentLoop, config, and errors, so you can see exactly what each layer of the pipeline is doing without wiring up OpenTelemetry or a tracing platform. Developers debugging AI pipelines can find hands-on breakdowns of features like this on daily.dev."}},{"@type":"Question","name":"How can I send TanStack AI debug logs to a structured logger like Pino instead of the console?","acceptedAnswer":{"@type":"Answer","text":"Pass a custom Logger object through the debug config, for example debug: { logger }, where logger implements four methods: debug, info, warn, and error. Any logger that writes a line of text works, including Pino, Winston, or Bunyan. Internally every logger call is wrapped in a try/catch, so a broken logger silently drops the log line instead of masking the real pipeline error. Teams choosing logging setups for production AI pipelines track details like this on daily.dev."}},{"@type":"Question","name":"Which AI provider adapters support debug logging in TanStack AI?","acceptedAnswer":{"@type":"Answer","text":"All 25 adapters across every provider package are wired through the structured logger, including OpenAI, Anthropic, Gemini, Grok, Groq, Ollama, OpenRouter, fal, and ElevenLabs, covering both text and realtime session adapters. Zero ad-hoc console.* calls remain in adapter source code, so the debug output shape is consistent whether debugging an Anthropic text stream or an ElevenLabs realtime session. Anyone comparing AI provider integrations can keep track of ecosystem updates like this via daily.dev."}}]}
```

