Debug LangWatch TypeScript SDK integration issues
import { setupObservability } from "langwatch/observability/setup/node"; const handle = await setupObservability({ langwatch: { apiKey: process.env.LANGWATCH_API_KEY, processorType: 'simple' // Use 'simple' for immediate export during debugging }, serviceName: "my-service", // Debug options for development debug: { consoleTracing: true, // Log spans to console consoleLogging: true, // Log records to console logLevel: 'debug' // SDK internal logging } });
import { setupObservability } from "langwatch/observability/setup/node"; // Create a custom logger const customLogger = { debug: (message: string) => console.log(`[DEBUG] ${message}`), info: (message: string) => console.log(`[INFO] ${message}`), warn: (message: string) => console.warn(`[WARN] ${message}`), error: (message: string) => console.error(`[ERROR] ${message}`), }; const handle = await setupObservability({ langwatch: { apiKey: process.env.LANGWATCH_API_KEY }, serviceName: "my-service", debug: { logger: customLogger, logLevel: 'debug' } });
import { setupObservability } from "langwatch/observability/setup/node"; const handle = await setupObservability({ langwatch: { apiKey: process.env.LANGWATCH_API_KEY }, serviceName: "my-service", // Advanced options for error handling advanced: { throwOnSetupError: true, // Throw errors instead of returning no-op handles } });
LANGWATCH_API_KEY
LANGWATCH_ENDPOINT
'simple'
'batch'
const handle = await setupObservability({ langwatch: { apiKey: process.env.LANGWATCH_API_KEY, processorType: 'simple' // Immediate export for debugging }, serviceName: "my-service", debug: { consoleTracing: true, consoleLogging: true, logLevel: 'info' // Raise this to `debug` if you're debugging the LangWatch integration } });
const handle = await setupObservability({ langwatch: { apiKey: process.env.LANGWATCH_API_KEY, processorType: 'batch' // Efficient batching for production }, serviceName: "my-service", debug: { consoleTracing: false, // Disable console output in production logLevel: 'warn' // Only log warnings and errors } });
Was this page helpful?