Skip to content

Commit f166b71

Browse files
committed
2 parents f3f2688 + a79e9bc commit f166b71

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

hooks/SessionStart/custom_config_python.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ def configure():
5959
print(f"export GOOGLE_ADS_CONFIGURATION_FILE_PATH=\"{target_yaml}\"", file=sys.stdout)
6060

6161
if __name__ == "__main__":
62+
log_file = os.path.expanduser("~/gemini_hook_log.txt")
63+
timestamp = datetime.datetime.now().isoformat()
64+
try:
65+
with open(log_file, "a") as f:
66+
f.write(f"SessionStart HOOK: custom_config_python.py ran at {timestamp}\n")
67+
print("DEBUG: custom_config_python.py wrote to log", file=sys.stderr)
68+
except Exception as e:
69+
# Try to print error to stderr, in case it's visible
70+
print(f"DEBUG: custom_config_python.py ERROR: {e}", file=sys.stderr)
71+
# Also write error to the log file
72+
try:
73+
with open(log_file, "a") as f:
74+
f.write(f"SessionStart HOOK ERROR: {timestamp} - {e}\n")
75+
except:
76+
pass # Oh well, we tried
77+
sys.stderr.flush()
78+
6279
timestamp = datetime.datetime.now()
6380
message = f"SUCCESS: SessionEnd hook 'cleanup_config.py' ran at {timestamp}"
6481
print(message, file=sys.stderr)

0 commit comments

Comments
 (0)