-
-
Notifications
You must be signed in to change notification settings - Fork 626
File logging #1053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File logging #1053
Conversation
@@ -100,11 +122,20 @@ function Runner.run(opts) | |||
list_ignored = opts.list_ignored, | |||
timeout = opts.timeout or 400, | |||
output = {}, | |||
_done = false | |||
rc = nil, -- -1 indicates timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Care has been taken to not alter the functionality or flow of control here. _done -> rc is the only significant change.
lua/nvim-tree/log.lua
Outdated
function M.setup(opts) | ||
M.config = opts.log | ||
if M.config and M.config.enable and M.config.types then | ||
M.path = string.format("%s/nvim-tree-%s-%s.log", vim.env.HOME, os.date("%H:%M:%S"), vim.env.USER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time is enough to uniquely identify the file. Date is too long.
lua/nvim-tree/log.lua
Outdated
function M.setup(opts) | ||
M.config = opts.log | ||
if M.config and M.config.enable and M.config.types then | ||
M.path = string.format("%s/nvim-tree-%s-%s.log", vim.env.HOME, os.date("%H:%M:%S"), vim.env.USER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we store that in vim.stdpath('data')
? I don't like programs not respecting XDG :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using vim.fn.stdpath("cache")
which is where nvim, packer and lsp put their logs.
Also printed this path at startup so that the user is aware.
I would be grateful for a successful test (notably the git bits) by @gegoune and @kyazdani42 before we merge this. There are a lot of moving parts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work thanks !
* add file logging infrastructure * log git runner operations * log configuration and mappings * document file logging infrastructure * style fixes * stylua fixes * document log file locations
Add the ability to log to a file. One file per nvim session is created.
Some logging has been added:
Configuration
Git runner
I have elected to put the logs in the user's home rather than /tmp, so that they don't forget about them. They may forget to turn logging off and many large files will accumulate.