Skip to content

Commit c5d25ed

Browse files
平地浩一claude
authored andcommitted
Add debug logging for DB save operations
保存処理にログを追加して、設定変更が正しくDBに保存されているか確認 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e45e472 commit c5d25ed

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

db_utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ def load_notitext() -> str:
8383

8484
def save_is_target_channel(channel_id: int, is_target: bool):
8585
"""チャンネル設定をD1に保存"""
86-
execute_d1_query(
86+
print(f"[DB] Saving is_target_channel: channel_id={channel_id}, is_target={is_target}")
87+
result = execute_d1_query(
8788
"INSERT OR REPLACE INTO is_target_channel (channel_id, is_target) VALUES (?, ?)",
8889
[channel_id, 1 if is_target else 0]
8990
)
91+
print(f"[DB] save_is_target_channel result: {result}")
9092

9193

9294
def load_is_target_channels() -> Dict[int, bool]:
@@ -102,10 +104,12 @@ def load_is_target_channels() -> Dict[int, bool]:
102104

103105
def save_channel_id(channel_id: int):
104106
"""通知先チャンネルIDをD1に保存"""
105-
execute_d1_query(
107+
print(f"[DB] Saving channel_id: {channel_id}")
108+
result = execute_d1_query(
106109
"INSERT OR REPLACE INTO bot_settings (key, value) VALUES (?, ?)",
107110
["channel_id", str(channel_id)]
108111
)
112+
print(f"[DB] save_channel_id result: {result}")
109113

110114

111115
def load_channel_id() -> Optional[int]:
@@ -121,10 +125,12 @@ def load_channel_id() -> Optional[int]:
121125

122126
def save_call_end_notification_enabled(enabled: bool):
123127
"""終了通知設定をD1に保存"""
124-
execute_d1_query(
128+
print(f"[DB] Saving is_call_end_notification_enabled: {enabled}")
129+
result = execute_d1_query(
125130
"INSERT OR REPLACE INTO bot_settings (key, value) VALUES (?, ?)",
126131
["is_call_end_notification_enabled", "1" if enabled else "0"]
127132
)
133+
print(f"[DB] save_call_end_notification_enabled result: {result}")
128134

129135

130136
def load_call_end_notification_enabled() -> Optional[bool]:

0 commit comments

Comments
 (0)