logs and debugging - panuozzo77/StreamingCommunity GitHub Wiki
This document explains how to use logging and debugging features in StreamingCommunity to diagnose and resolve issues.
StreamingCommunity includes a debug mode that provides more detailed information about what's happening during execution.
To enable debug mode, edit your config.json
file:
{
"DEFAULT": {
"debug": true
}
}
For the Telegram bot, you can enable debugging by setting the DEBUG
environment variable in your .env
file:
DEBUG=True
When debug mode is enabled, the application will output detailed logs to:
- Console: Logs are displayed in the terminal
- Log Files: Depending on the component, logs may be written to files
Log messages typically follow this format:
[LEVEL] [TIMESTAMP] [MODULE] Message
Where:
- LEVEL: Indicates the severity (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- TIMESTAMP: When the event occurred
- MODULE: Which part of the application generated the message
- Message: The actual log content
- DEBUG: Detailed information, typically of interest only when diagnosing problems
- INFO: Confirmation that things are working as expected
- WARNING: Indication that something unexpected happened, but the application is still working
- ERROR: Due to a more serious problem, the application has not been able to perform some function
- CRITICAL: A serious error, indicating that the application itself may be unable to continue running
When debug mode is enabled, you'll see additional information about:
- Network Requests: URLs, headers, response codes
- API Responses: Raw data from streaming sites
- Parser Operations: Details about content extraction
- Download Progress: Detailed segment information
- FFmpeg Operations: Command lines and conversion details
To debug network-related issues:
- Enable debug mode
- Look for log entries related to requests and responses
- Check for HTTP status codes, timeouts, or connection errors
- Verify that URLs are correctly formed and accessible
To debug content parsing issues:
- Enable debug mode
- Look for log entries from parser modules
- Check if the expected content structure was found
- Verify that selectors and extraction patterns are working
To debug download problems:
- Enable debug mode
- Look for log entries from downloader modules
- Check for segment download failures or timeouts
- Verify that M3U8 playlists are correctly parsed
To debug media processing problems:
- Enable debug mode
- Look for log entries related to FFmpeg commands
- Check for FFmpeg error codes or warnings
- Verify that FFmpeg is correctly installed and accessible
You can manually test site APIs using tools like curl or Postman:
curl -v -H "User-Agent: Mozilla/5.0" "https://example-site.com/api/search?q=test"
Use tools like Wireshark or the browser's Developer Tools to analyze network traffic:
- Open your browser's Developer Tools (F12)
- Go to the Network tab
- Visit the streaming site manually
- Observe the requests and responses
For developers, you can add custom debug code:
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
# Add debug points
logger.debug(f"Variable value: {variable}")
For Telegram bot issues:
- Set
DEBUG=True
in your.env
file - Check the console output for detailed logs
- Verify that the bot is correctly registered with Telegram
- Ensure your user ID is correctly set in the
AUTHORIZED_USER_ID
variable
When reporting bugs, include:
- Log Output: Full debug logs
- Configuration: Your config.json (with sensitive information removed)
- Environment: Python version, OS, and installed packages
- Steps to Reproduce: Detailed steps to recreate the issue
- Expected vs. Actual Behavior: What you expected and what happened instead
- Common Issues - Solutions to frequently encountered problems
- Updating Domains - How to update site domains
- Configuration Overview - Learn about configuration options