Skip to content

feat: add configurable debug logging#40

Merged
Cannon07 merged 1 commit intomainfrom
feat/configurable-logging
Apr 19, 2026
Merged

feat: add configurable debug logging#40
Cannon07 merged 1 commit intomainfrom
feat/configurable-logging

Conversation

@Cannon07
Copy link
Copy Markdown
Owner

@Cannon07 Cannon07 commented Apr 19, 2026

Summary

  • Adds a thin logging module (lua/code-preview/log.lua) — opt-in via debug = true in setup()
  • DEBUG/INFO write to ~/.local/state/nvim/code-preview.log (file only); WARN/ERROR also call vim.notify()
  • Both Lua modules (diff.lua, neo_tree.lua) and shell scripts (core-pre-tool.sh, core-post-tool.sh) write to the same log file for unified debugging
  • Shell scripts query the debug flag from Neovim via RPC, so no separate env var config is needed

Test plan

  • All 22 tests pass (bash tests/run.sh)
  • Enable debug = true in setup, trigger a diff — verify log file appears at ~/.local/state/nvim/code-preview.log
  • Verify log entries from both Lua (show_diff, close_for_file) and shell (core-pre-tool, core-post-tool)
  • Verify debug = false (default) produces no log file writes

Add opt-in debug logging following Neovim plugin conventions. Lua and
shell scripts write to the same log file for unified debugging.

- Create lua/code-preview/log.lua (DEBUG/INFO to file, WARN/ERROR also via vim.notify)
- Add `debug = false` config option, log file at stdpath("log")/code-preview.log
- Wire logging into diff.lua, neo_tree.lua, and both shell hook scripts
- Expose debug flag and log path in hook_context() for shell scripts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Cannon07 Cannon07 merged commit ac255f3 into main Apr 19, 2026
2 checks passed
@Cannon07 Cannon07 deleted the feat/configurable-logging branch April 19, 2026 21:26
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.

1 participant