Skip to content

Move logger setup to after MODE selection - #126

Merged
ldayton merged 3 commits into
ldayton:mainfrom
nickdavies:log_path
Jun 8, 2026
Merged

Move logger setup to after MODE selection#126
ldayton merged 3 commits into
ldayton:mainfrom
nickdavies:log_path

Conversation

@nickdavies

Copy link
Copy Markdown
Contributor

Because we call setup_logging before deciding on the mode the log file is always .claude/hook-approvals.log even for cursor

This split the logger setup in two, first we do basic logging setup with the right format etc so that we don't lose messages related to parsing input and setup and then once we know the mode we are in we call the file logger.

Nick Davies and others added 3 commits March 24, 2026 09:06
Because we call `setup_logging` before deciding on the mode the log file
is always `.claude/hook-approvals.log` even for cursor

This split the logger setup in two, first we do basic logging setup with
the right format etc so that we don't lose messages related to parsing
input and setup and then once we know the mode we are in we call the
file logger.
basicConfig(level=INFO) attached an INFO stderr handler, so every decision
printed to stderr on each invocation. Set root+file to INFO (audit log
unchanged) but the stderr handler to WARNING, so only early failures (bad
JSON, unknown tool) surface there.
@ldayton
ldayton merged commit 324d2a2 into ldayton:main Jun 8, 2026
1 check passed
orgoj pushed a commit to orgoj/Dippy that referenced this pull request Aug 10, 2026
…yton#126)

setup_logging() ran before mode detection, so the log file always went to
~/.claude/ regardless of mode. Split it: detect the mode first, then attach
the file handler so the log lands in the right directory.

Also add an early stderr handler at WARNING level so failures that happen
before the file handler exists (bad JSON, unknown tool) are still visible,
while routine INFO decisions stay quiet on stderr and continue to the audit
file as before.

Co-authored-by: Lily Dayton <43729618+ldayton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants