Skip to content

Commit

Permalink
feat: add logging to file (#166)
Browse files Browse the repository at this point in the history
* feat: add logging to file

* chore: update README and auto-generate vimdoc

* chore: fmt

* chore: default log path to stdpath('log')

* chore: support logger.trace

* chore: update README and auto-generate vimdoc

* chore: don't notify about debug and trace

* chore: add uuid to log msgs to differentiate neovim instances

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Robitx and github-actions[bot] authored Jul 23, 2024
1 parent acf18d8 commit 33812a6
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 94 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Voice commands (`:GpWhisper*`) depend on `SoX` (Sound eXchange) to handle audio
Below is a linked snippet with the default values, but I suggest starting with minimal config possible (just `openai_api_key` if you don't have `OPENAI_API_KEY` env set up). Defaults change over time to improve things, options might get deprecated and so on - it's better to change only things where the default doesn't fit your needs.

<!-- README_REFERENCE_MARKER_REPLACE_NEXT_LINE -->
https://github.com/Robitx/gp.nvim/blob/a062dbea91340fc6423fd06b6c3f84f252ba8f38/lua/gp/config.lua#L9-L565
https://github.com/Robitx/gp.nvim/blob/475c9771fdef9a90f0a90fcb6b824736cec671f1/lua/gp/config.lua#L9-L568

# Usage

Expand Down
2 changes: 1 addition & 1 deletion doc/gp.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ options might get deprecated and so on - it’s better to change only things
where the default doesn’t fit your needs.


https://github.com/Robitx/gp.nvim/blob/a062dbea91340fc6423fd06b6c3f84f252ba8f38/lua/gp/config.lua#L9-L565
https://github.com/Robitx/gp.nvim/blob/475c9771fdef9a90f0a90fcb6b824736cec671f1/lua/gp/config.lua#L9-L568


==============================================================================
Expand Down
5 changes: 4 additions & 1 deletion lua/gp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ local config = {
-- curl_params = { "--proxy", "http://X.X.X.X:XXXX" }
curl_params = {},

-- log file location
log_file = vim.fn.stdpath("log"):gsub("/$", "") .. "/gp.nvim.log",

-- directory for persisting state dynamically changed by user (like model or persona)
state_dir = vim.fn.stdpath("data"):gsub("/$", "") .. "/gp/persisted",

Expand Down Expand Up @@ -512,7 +515,7 @@ local config = {
.. "\n\nRespond exclusively with the snippet that should replace the selection above."

local agent = gp.get_command_agent()
gp.info("Implementing selection with agent: " .. agent.name)
gp.logger.info("Implementing selection with agent: " .. agent.name)

gp.Prompt(
params,
Expand Down
Loading

0 comments on commit 33812a6

Please sign in to comment.