Overview
tif1 provides logging functions to control verbosity and debug output. The logging system uses Python’s standardlogging module with customizable levels.
Functions
setup_logging()
level(int, optional): Logging level constant from Python’sloggingmodule. Defaults tologging.WARNING
logging.DEBUG- Detailed information for debugginglogging.INFO- Informational messageslogging.WARNING- Warning messages (default)logging.ERROR- Error messageslogging.CRITICAL- Critical errors
- Sets up basic logging configuration with timestamp formatting
- Configures the tif1 logger to the specified level
- Suppresses noisy urllib3_future connection warnings (sets to ERROR level)
set_log_level()
level(str): Log level name as a string:"DEBUG"- Detailed debugging information"INFO"- General informational messages"WARNING"- Warning messages"ERROR"- Error messages"CRITICAL"- Critical errors
Log Format
The default log format includes:- Timestamp (YYYY-MM-DD HH:MM:SS)
- Logger name
- Log level
- Message
Configuration via Config
You can also set the log level through the configuration system:.tif1rc configuration file:
Examples
Basic Setup
Conditional Debug Mode
Using fastf1-Compatible Function
Info Level for Production
Quiet Mode (Errors Only)
Custom Logger Configuration
Environment-Based Configuration
Log Categories
tif1 uses different loggers for different components:| Logger | Component |
|---|---|
tif1 | Root logger for all tif1 messages |
tif1.config | Configuration loading and validation |
tif1.cache | Cache operations (hits, misses, writes) |
tif1.core | Core data loading and session management |
tif1.retry | Retry logic and circuit breaker |
tif1.async_fetch | Async HTTP fetching |
tif1.http_session | HTTP session management |
tif1.cdn | CDN operations and fallbacks |
Filter Specific Components
Typical Log Messages
DEBUG Level
INFO Level
WARNING Level
ERROR Level
Best Practices
-
Development: Use
DEBUGlevel to see all operations -
Production: Use
WARNING(default) orERRORto reduce noise -
Debugging Issues: Enable
DEBUGtemporarily to diagnose problems -
CI/CD: Use
ERRORlevel to keep logs clean -
File Logging: Add file handler for persistent logs
Source Code
For the complete implementation:setup_logging():__init__.py:120-140set_log_level():fastf1_compat.py(re-exported in__init__.py:89)