#output debug logs from dev
3 messages · Page 1 of 1 (latest)
Hi @fervent tulip. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Astro provides several tools to help you debug your code. One of the simplest methods is using console.log(). Where you write your console.log() statement will determine where your debugging output is printed. A console.log() statement in Astro frontmatter will always output to the terminal running the Astro CLI. This is because Astro runs on the server, and never in the browser. Code that is written or imported inside of an Astro <script> tag is run in the browser. Any console.log() statements or other debug output will be printed to the console in your browser source (https://docs.astro.build/en/guides/troubleshooting#_top).
Astro also provides a built-in <Debug /> component which renders any value directly into your component HTML template. This is useful for quick debugging in the browser without having to flip back-and-forth between your terminal and your browser source (https://docs.astro.build/en/guides/troubleshooting#astro-debug--component).
If you're experiencing segfaults, it might be due to an error in your code. Astro's CLI has been redesigned to provide more terse errors and refined stack traces, making it easier to read, parse, and debug source (https://astro.build/blog/astro-4#redesigned-logging).