logging package. All logging follows a hierarchical naming convention to
provide clear operational visibility and debugging capabilities.
Basic Usage
By default, dartantic logging is disabled. You can enable logging by setting theloggingOptions property of the Agent class to an instance of the
LoggingOptions class:
Logging Levels
TheloggingOptions property of the Agent class can be set to a
LoggingOptions object to configure the logging level.
| Level | Use Case | Output |
|---|---|---|
Level.FINE | Development | Verbose |
Level.INFO | General | Moderate |
Level.WARNING | Production | Minimal |
Filter by String
You can filter logging by a string by setting thefilter property of the
LoggingOptions class to a string that matches the logging output:
Environment Variable
Set logging without touching code by exportingDARTANTIC_LOG_LEVEL before you
run your app. Any value accepted by package:logging works (INFO, FINE,
WARNING, OFF, etc.):
Agent.loggingOptions reads this environment variable and adopts
the requested logging level automatically. You can still override it in code if
you need more granular control.
Examples
Next Steps
- Automatic Retry - Handle rate limits
- Usage Tracking - Monitor costs

