Debugging And Logging - edgeof8/tIRC GitHub Wiki
Effective logging is crucial for understanding tIRC's behavior, troubleshooting issues, and aiding in development. This page outlines tIRC's logging capabilities and provides tips for debugging.
Logging Configuration
tIRC's logging behavior is configured in the config/tirc_config.ini
file, primarily under the [Logging]
section. Key options mentioned in the README.md
include:
log_enabled
: (e.g.,true
orfalse
) Master switch to enable or disable logging.log_file
: Path to the main application log file (e.g.,logs/tirc_core.log
).log_level
: Sets the verbosity of logs. Common levels:DEBUG
: Very detailed information, useful for diagnosing problems.INFO
: General operational information.WARNING
: Indication of potential issues.ERROR
: Errors that occurred but didn't necessarily crash the application.CRITICAL
: Severe errors that might lead to application termination.
- Log Rotation: Settings like
log_max_bytes
andlog_backup_count
(if available) control log file size and rotation. channel_log_enabled
: (e.g.,true
orfalse
) Enables or disables logging of messages for each joined channel to separate files.
The logs/
directory is typically created automatically in tIRC's working directory if it doesn't exist.
Log File Locations
Based on the README.md
's file structure and logging section, common log files include:
- Main Application Log:
logs/tirc_core.log
(Contains general application logs, events, and errors based on the configuredlog_level
). - Error Log:
logs/tirc_error.log
(May contain only error-level messages or more critical issues, depending on specific configuration). - Status Window Log:
logs/client_status_messages.log
(Logs messages that appear in the client's main status window). - DCC Log:
logs/dcc.log
(Specific logs related to DCC transfers). - Per-Channel Logs:
logs/(channel_name).log
(Ifchannel_log_enabled
is true, each channel's conversation is logged to a file named after the channel, e.g.,logs/#python.log
).
Always check your tirc_config.ini
for the exact configured paths and names.
Raw IRC Message Logging
tIRC provides a command to toggle the display of raw IRC messages directly in the UI (usually the Status window):
/rawlog [on|off|toggle]
: This command helps in debugging protocol-level interactions with the IRC server by showing the exact messages sent and received.
Debugging Tips
- Increase Log Level: If you're troubleshooting an issue, set
log_level = DEBUG
in yourtirc_config.ini
and restart tIRC. This will provide the most detailed logs. Remember to set it back toINFO
orWARNING
for normal operation to avoid excessively large log files. - Check Relevant Logs:
- For general issues, start with
logs/tirc_core.log
. - For connection problems, raw IRC messages (via
/rawlog
or debug logs) can be very insightful. - For DCC issues, check
logs/dcc.log
. - For script-related problems, scripts can use
self.api.log_debug()
,self.api.log_info()
, etc., and their output will appear in the main application log.
- For general issues, start with
- Reproduce the Issue: Try to reliably reproduce the problem. Note the steps taken and the approximate time it occurred. This helps correlate actions with log entries.
- Timestamps: Log entries usually have timestamps. Use these to narrow down the relevant sections of the log files.
- Search for Errors: Look for lines containing "ERROR", "CRITICAL", "Exception", or "Traceback" in the logs.
- Headless Mode: For issues that might be UI-related or for testing core logic, running tIRC in
--headless
mode can sometimes help isolate the problem. - Configuration Check: Many issues stem from incorrect configuration. Double-check your
tirc_config.ini
against examples and documentation. The client may also log configuration errors on startup. - Community Support: If you're unable to diagnose an issue, consider seeking help from the community or reporting a bug. Provide relevant (sanitized) log snippets and steps to reproduce. See the Support page for more information.
Understanding and utilizing tIRC's logging features is key to a smooth experience and effective troubleshooting.