MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / _log

Method _log

gui/app.py:1123–1138  ·  view source on GitHub ↗

Add message to log area.

(self, message: str, save_to_file: bool = True)

Source from the content-addressed store, hash-verified

1121 # Logging
1122 # =========================================================================
1123 def _log(self, message: str, save_to_file: bool = True):
1124 """Add message to log area."""
1125 timestamp = datetime.now().strftime("%H:%M:%S")
1126 formatted = f"[{timestamp}] {message}"
1127
1128 self.log_area.configure(state="normal")
1129 self.log_area.insert("end", f"{formatted}\n")
1130 self.log_area.see("end")
1131 self.log_area.configure(state="disabled")
1132
1133 if save_to_file:
1134 try:
1135 with open(LOG_FILE, "a", encoding="utf-8") as f:
1136 f.write(f"{formatted}\n")
1137 except Exception:
1138 pass
1139
1140 def _clear_logs(self):
1141 """Clear log area."""

Callers 15

_save_configMethod · 0.95
_save_logsMethod · 0.95
_load_accountsMethod · 0.95
_add_new_accountMethod · 0.95
_delete_accountMethod · 0.95
_copy_api_urlMethod · 0.95

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected