For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Help on Discord
HomeGuideExamplesBAML ReferencePlaygroundAgents.mdChangelog
HomeGuideExamplesBAML ReferencePlaygroundAgents.mdChangelog
  • Introduction
    • What is BAML?
    • Why BAML?
    • What's the baml_src folder
    • What's baml_client
  • Installation: Editors
    • VSCode Extension
    • Cursor Extension
    • JetBrains IDEs
    • Zed
    • Claude Code
    • Others
  • Installation: Language
    • Python
    • Typescript
    • Go
    • Ruby
    • Rust
    • REST API (other languages)
    • Elixir
  • Framework Integration
  • Development
    • Environment Variables
    • Terminal Logs
    • Upgrade BAML versions
  • BAML Basics
    • Prompting with BAML
    • Switching LLMs
    • Testing functions
    • Streaming
    • Multi-Modal (Images / Audio)
    • Error Handling
    • Configuring Timeouts
    • Concurrent Calls
    • AbortSignal / Cancellation
  • BAML Advanced
    • Collector (track tokens)
    • LLM Client Registry
    • Dynamic Types
    • Reusing Prompt Snippets
    • Prompt Caching / Message Role Metadata
    • Checks and Asserts
    • Modular API
    • Prompt Optimization
  • Boundary Cloud
  • Comparisons
    • BAML vs Langchain
    • BAML vs Marvin
    • BAML vs Ai-SDK
    • BAML vs OpenAI SDK
    • BAML vs Pydantic
    • Contact
Help on Discord
LogoLogo
Development

Terminal Logs

Was this page helpful?
Edit this page
Previous

Upgrading BAML / Fixing Version Mismatches

Next
Built with

You can add logging to determine what the BAML runtime is doing when it calls LLM endpoints and parses responses.

To enable logging, set the BAML_LOG environment variable:

1# default is info
2BAML_LOG=info
1// Set logging level in Go application
2os.Setenv("BAML_LOG", "info")
3
4// Or run with environment variable:
5// BAML_LOG=info go run main.go
LevelDescription
errorFatal errors by BAML
warnLogs any time a function fails (includes LLM calling failures, parsing failures)
infoLogs every call to a function (including prompt, raw response, and parsed response)
debugRequests and detailed parsing errors (warning: may be a lot of logs)
traceEverything and more
offNo logging

Example log:


Since >0.54.0:

To truncate each log entry to a certain length, set the BOUNDARY_MAX_LOG_CHUNK_CHARS environment variable:

1BOUNDARY_MAX_LOG_CHUNK_CHARS=3000

This will truncate each part in a log entry to 3000 characters.

1// Set log truncation in Go application
2os.Setenv("BOUNDARY_MAX_LOG_CHUNK_CHARS", "3000")
3
4// Example with both logging and truncation
5func main() {
6 // Configure logging
7 os.Setenv("BAML_LOG", "info")
8 os.Setenv("BOUNDARY_MAX_LOG_CHUNK_CHARS", "3000")
9
10 // Your application code here
11}