Skip to content

Addition of logger #6 - #383

Merged
AntoineGS merged 32 commits into
zbirenbaum:masterfrom
AntoineGS:logger
Mar 21, 2025
Merged

Addition of logger #6#383
AntoineGS merged 32 commits into
zbirenbaum:masterfrom
AntoineGS:logger

Conversation

@AntoineGS

Copy link
Copy Markdown
Collaborator

Addition of a new unit (logger.lua) to centralize the logging and the notify processes, including new configurations to trace and log messages from the LSP.

config:

  logger = {
    log_to_file = false,
    file = vim.fn.stdpath("log") .. "/copilot-lua.log",
    file_log_level = vim.log.levels.WARN,
    print_log = true,
    print_log_level = vim.log.levels.WARN,
    trace_lsp = "off", -- "off" | "messages" | "verbose"
    trace_lsp_progress = false,
  },

From the Readme:

logger

When log_to_file is true, logs will be written to the file for anything of file_log_level or higher.
When print_log is true, logs will be printed to NeoVim (using notify) for anything of print_log_level or higher.
File logging is done asynchronously to minimize performance impacts, however there is still some overhead.

Log levels used are the ones defined in vim.log:

vim.log = {
  levels = {
    TRACE = 0,
    DEBUG = 1,
    INFO = 2,
    WARN = 3,
    ERROR = 4,
    OFF = 5,
  },
}

trace_lsp can either be off, messages which will output the LSP messages, or verbose which adds additonal information to the message.
When trace_lsp_progress is true, LSP progress messages will also be logged.

Careful turning on all logging features as the log files may get very large over time, and are not pruned by the application.

Fixes #356

language server now expects to be run directly through language-server.js
the configuration supports overriding the default function as get_root_dir
fixes zbirenbaum#371
the configuration supports overriding the default function as get_root_dir
fixes zbirenbaum#371
@AntoineGS
AntoineGS merged commit 256393d into zbirenbaum:master Mar 21, 2025
@AntoineGS
AntoineGS deleted the logger branch March 22, 2025 19:40
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.

Missing logger (i.e.copilot logs available in copilot.vim)

1 participant