Replace print statements with proper logging
Fixed inconsistent error handling in ai_provider.py and memory.py by: - Adding optional logger parameter to PerplexityProvider and ConversationMemory classes - Replacing all print() statements with proper logger.error() calls - Updating chatbot.py to pass logger instance to both components - Ensuring consistent logging architecture across the codebase This improves error visibility and integrates with the existing logging infrastructure.
This commit is contained in:
parent
a1f30c31c6
commit
2b15ceeaa1
3 changed files with 22 additions and 12 deletions
10
chatbot.py
10
chatbot.py
|
|
@ -30,18 +30,22 @@ class EugenBot(irc.bot.SingleServerIRCBot):
|
|||
self.bot_name = config.bot_name
|
||||
self.channel = config.twitch_channel
|
||||
|
||||
# Initialize logger first
|
||||
self.logger = Logger(log_dir=config.log_dir, debug_mode=config.debug_mode)
|
||||
|
||||
# Initialize components
|
||||
self.memory = ConversationMemory(
|
||||
data_dir=config.data_dir,
|
||||
retention_hours=config.context_retention_hours
|
||||
retention_hours=config.context_retention_hours,
|
||||
logger=self.logger
|
||||
)
|
||||
self.ai = PerplexityProvider(
|
||||
api_key=config.perplexity_key,
|
||||
model=config.model,
|
||||
max_tokens=config.max_tokens
|
||||
max_tokens=config.max_tokens,
|
||||
logger=self.logger
|
||||
)
|
||||
self.detector = MentionDetector(bot_name=self.bot_name)
|
||||
self.logger = Logger(log_dir=config.log_dir, debug_mode=config.debug_mode)
|
||||
|
||||
# Dashboard (will be initialized in GUI thread)
|
||||
self.dashboard = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue