astonishing-ability-75576
10/12/2025, 9:54 AMtall-airline-16756
10/12/2025, 9:54 AMtall-airline-16756
10/12/2025, 9:54 AMinitializeLogger function from the LiveKit Agents SDK. This function takes a LoggerOptions object with two handy properties:
• pretty: Set this to true if you'd like human-readable logs (great for development), or false if you prefer JSON-formatted logs (ideal for production).
• level: This lets you specify the log level, such as info or debug, depending on what details you want to see.
Here’s a simple example to get you started:
import { initializeLogger } from '@livekit/agents';
// For pretty-printed logs (development)
initializeLogger({ pretty: true, level: 'info' });
// For JSON logs (production)
initializeLogger({ pretty: false, level: 'info' });
If you're looking to customize things further, like adjusting colors or adding metadata, that would involve configuring pino-pretty options directly. Just a heads-up, though—these advanced options aren’t exposed in the current SDK version yet.
Please feel free to reach out if you want to dive deeper or need any more help—I’m here to support you every step of the way!
Sources: Log collection | LiveKit Docs | Worker options | LiveKit Docs | package-lock.json | agents/src/log.tsastonishing-ability-75576
10/12/2025, 9:56 AMtall-airline-16756
10/12/2025, 9:57 AMinfo, warn, and error. Plus, it lets you include structured data to give more context, which can be really helpful.
Here’s a simple example to get you started:
// Log an informational message
logger.info({ retries: 3 }, 'Recovered from text-only response');
// Log a warning message
logger.warn({ responseId: '12345' }, 'Received text-only response from API');
// Log an error message
logger.error({ errorCode: '500' }, 'An unexpected error occurred');
What’s great is that the logger works hand-in-hand with LiveKit's metrics and telemetry system. This means you can use it not just for debugging but also for monitoring and tracking custom events throughout your agent sessions. If you have any questions or need further help, feel free to ask—I’m here to help!
Sources: plugins/openai/src/realtime/realtime_model.ts | Worker options | LiveKit Docs | Logs, metrics, and telemetry | LiveKit Docsastonishing-ability-75576
10/12/2025, 9:57 AMtall-airline-16756
10/12/2025, 9:58 AM@livekit/agents package and uses the pino logging library behind the scenes. You’ll find it’s initialized through the initializeLogger function that comes with this package.
To get started, just make sure the @livekit/agents package is installed and properly set up in your environment. From there, you can call log() to grab a logger instance and easily write logs at different levels like info, warn, and error. If you have any questions along the way, feel free to ask—I’m here to help!
Sources: README.md | Logs, metrics, and telemetry | LiveKit Docs