Feat: Improve Logging for Go Server (#68)
This MR adds an optional `debug` object to the configuration table to help users debug any connectivity issues with Gitlab. The table lets you log the requests and responses from the Go server.
This commit is contained in:
+13
-11
@@ -12,16 +12,18 @@ M.start = function(callback)
|
||||
local parsed_port = nil
|
||||
local callback_called = false
|
||||
local command = state.settings.bin
|
||||
.. " "
|
||||
.. state.settings.project_id
|
||||
.. " "
|
||||
.. state.settings.gitlab_url
|
||||
.. " "
|
||||
.. port
|
||||
.. " "
|
||||
.. state.settings.auth_token
|
||||
.. " "
|
||||
.. state.settings.log_path
|
||||
.. " "
|
||||
.. state.settings.project_id
|
||||
.. " "
|
||||
.. state.settings.gitlab_url
|
||||
.. " "
|
||||
.. port
|
||||
.. " "
|
||||
.. state.settings.auth_token
|
||||
.. " "
|
||||
.. "'" .. vim.json.encode(state.settings.debug) .. "'"
|
||||
.. " "
|
||||
.. state.settings.log_path
|
||||
|
||||
local job_id = vim.fn.jobstart(command, {
|
||||
on_stdout = function(_, data)
|
||||
@@ -86,7 +88,7 @@ M.build = function(override)
|
||||
end
|
||||
|
||||
local cmd = u.is_windows() and "cd %s\\cmd && go build -o bin.exe && move bin.exe ..\\"
|
||||
or "cd %s/cmd && go build -o bin && mv bin ../bin"
|
||||
or "cd %s/cmd && go build -o bin && mv bin ../bin"
|
||||
|
||||
local command = string.format(cmd, state.settings.bin_path)
|
||||
local null = u.is_windows() and " >NUL" or " > /dev/null"
|
||||
|
||||
@@ -7,8 +7,9 @@ local u = require("gitlab.utils")
|
||||
local M = {}
|
||||
|
||||
-- These are the default settings for the plugin
|
||||
M.settings = {
|
||||
M.settings = {
|
||||
port = nil, -- choose random port
|
||||
debug = { go_request = false, go_response = false },
|
||||
log_path = (vim.fn.stdpath("cache") .. "/gitlab.nvim.log"),
|
||||
reviewer = "delta",
|
||||
attachment_dir = "",
|
||||
|
||||
Reference in New Issue
Block a user