Logging
Centralized logging configuration for TAF.
This module provides logging configuration that can be imported and used throughout the project. Each module should use:
import logging
logger = logging.getLogger(__name__)
This ensures proper hierarchical logging with module-specific loggers.
Typical usage example
from agentflow.utils.logging import configure_logging configure_logging(level=logging.DEBUG)
Functions:
| Name | Description |
|---|---|
configure_logging |
Configures the root logger for the TAF project. |
Functions¶
configure_logging
¶
configure_logging(level=logging.INFO, format_string=None, handler=None)
Configures the root logger for the TAF project.
This function sets up logging for all modules under the 'agentflow' namespace. It ensures that logs are formatted consistently and sent to the appropriate handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Logging level (e.g., logging.INFO, logging.DEBUG). Defaults to logging.INFO. |
INFO
|
|
str
|
Custom format string for log messages. If None, uses a default format: "[%(asctime)s] %(levelname)-8s %(name)s: %(message)s". |
None
|
|
Handler
|
Custom logging handler. If None, uses StreamHandler to stdout. |
None
|
Returns:
| Type | Description |
|---|---|
None
|
None |
Example
configure_logging(level=logging.DEBUG) logger = logging.getLogger("agentflow.module") logger.info("This is an info message.")
Source code in agentflow/utils/logging.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |