diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
commit | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch) | |
tree | d8c1843a95da5ea0bb4acc09f7e37843d9995c86 /runtime/lua/vim/lsp/log.lua | |
parent | 142d9041391780ac15b89886a54015fdc5c73995 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.gz rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.bz2 rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.zip |
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'runtime/lua/vim/lsp/log.lua')
-rw-r--r-- | runtime/lua/vim/lsp/log.lua | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua index d1a78572aa..6d2e0bc292 100644 --- a/runtime/lua/vim/lsp/log.lua +++ b/runtime/lua/vim/lsp/log.lua @@ -2,14 +2,12 @@ local log = {} --- FIXME: DOC --- Should be exposed in the vim docs. --- --- Log level dictionary with reverse lookup as well. --- --- Can be used to lookup the number from the name or the name from the number. --- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF" --- Level numbers begin with "TRACE" at 0 +--- Log level dictionary with reverse lookup as well. +--- +--- Can be used to lookup the number from the name or the name from the number. +--- Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF" +--- Level numbers begin with "TRACE" at 0 +--- @nodoc log.levels = vim.deepcopy(vim.log.levels) -- Default log level is warn. @@ -20,7 +18,6 @@ local format_func = function(arg) end do - ---@private local function notify(msg, level) if vim.in_fast_event() then vim.schedule(function() @@ -31,8 +28,7 @@ do end end - local path_sep = vim.loop.os_uname().version:match('Windows') and '\\' or '/' - ---@private + local path_sep = vim.uv.os_uname().version:match('Windows') and '\\' or '/' local function path_join(...) return table.concat(vim.tbl_flatten({ ... }), path_sep) end @@ -44,13 +40,12 @@ do vim.fn.mkdir(vim.fn.stdpath('log'), 'p') --- Returns the log filename. - ---@returns (string) log filename + ---@return string log filename function log.get_filename() return logfilename end local logfile, openerr - ---@private --- Opens log file. Returns true if file is open, false on error local function open_logfile() -- Try to open file only once @@ -68,7 +63,7 @@ do return false end - local log_info = vim.loop.fs_stat(logfilename) + local log_info = vim.uv.fs_stat(logfilename) if log_info and log_info.size > 1e9 then local warn_msg = string.format( 'LSP client log is large (%d MB): %s', @@ -141,7 +136,7 @@ end vim.tbl_add_reverse_lookup(log.levels) --- Sets the current log level. ----@param level (string|number) One of `vim.lsp.log.levels` +---@param level (string|integer) One of `vim.lsp.log.levels` function log.set_level(level) if type(level) == 'string' then current_log_level = @@ -154,7 +149,7 @@ function log.set_level(level) end --- Gets the current log level. ----@return string current log level +---@return integer current log level function log.get_level() return current_log_level end @@ -167,11 +162,10 @@ function log.set_format_func(handle) end --- Checks whether the level is sufficient for logging. ----@param level number log level +---@param level integer log level ---@returns (bool) true if would log, false if not function log.should_log(level) return level >= current_log_level end return log --- vim:sw=2 ts=2 et |