output
π€ AI-Generated Content
This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.
flavor.output
¶
Output formatting and redirection for Flavor tools.
Classes¶
OutputHandler
¶
Handles output formatting and redirection.
Initialize output handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
format
|
OutputFormat
|
Output format (text or json) |
TEXT
|
file
|
str | None
|
Output file path, or "STDOUT", "STDERR" (default: STDOUT) |
None
|
Source code in flavor/output.py
Functions¶
__enter__
¶
__exit__
¶
Context manager exit - flush any buffered output.
error
¶
Write an error message.
Source code in flavor/output.py
info
¶
success
¶
write
¶
Write output in the configured format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Data to output (string for text, dict/list for JSON) |
required |
**kwargs
|
Any
|
Additional metadata for JSON output |
{}
|
Source code in flavor/output.py
Functions¶
get_output_handler
¶
Create output handler from environment or defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
format_env
|
str | None
|
Environment variable name for format (default: FLAVOR_OUTPUT_FORMAT) |
None
|
file_env
|
str | None
|
Environment variable name for file (default: FLAVOR_OUTPUT_FILE) |
None
|
Returns:
| Type | Description |
|---|---|
OutputHandler
|
Configured OutputHandler |