Logging with any-agent
any-agent
comes with a logger powered by Rich
Quick Start
By default, logging is set up for you. But if you want to customize it, you can call:
Customizing the Logger
View the docstring in setup_logger
for a description of the arguments available .
Example: Set Log Level to DEBUG
Example: Custom Log Format
Example: Propagate Logs
any_agent.logging.setup_logger(level=logging.ERROR, rich_tracebacks=True, log_format=None, propagate=False, **kwargs)
Configure the any_agent logger with the specified settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level
|
int
|
The logging level to use (default: logging.INFO) |
ERROR
|
rich_tracebacks
|
bool
|
Whether to enable rich tracebacks (default: True) |
True
|
log_format
|
str | None
|
Optional custom log format string |
None
|
propagate
|
bool
|
Whether to propagate logs to parent loggers (default: False) |
False
|
**kwargs
|
Any
|
Additional keyword arguments to pass to RichHandler |
{}
|