Vlog.nvim
Single file, no dependency, easy copy & paste log file to add to your neovim lua plugins
Install / Use
/learn @tjdevries/Vlog.nvimREADME
vlog.nvim
A logger for neovim
Single file, no dependency, easy copy & paste log file to add to your neovim lua plugins.
Usage
-- Provides both `print` style and `string.format` style logging
log.info("I can pass", my_arg, "like I can for `print`")
log.fmt_info("I can pass %s arguments like `string.format`", my_arg)
-- Provides
log.trace(...)
log.debug(...)
log.info(...)
log.warn(...)
log.error(...)
log.fatal(...)
-- and the corresponding
log.fmt_trace(...)
log.fmt_debug(...)
log.fmt_info(...)
log.fmt_warn(...)
log.fmt_error(...)
log.fmt_fatal(...)
Configuration
The following values are configurable:
local default_config = {
-- Name of the plugin. Prepended to log messages
plugin = 'vlog.nvim',
-- Should print the output to neovim while running
use_console = true,
-- Should highlighting be used in console (using echohl)
highlights = true,
-- Should write to a file
use_file = true,
-- Any messages above this level will be logged.
level = "trace",
-- Level configuration
modes = {
{ name = "trace", hl = "Comment", },
{ name = "debug", hl = "Comment", },
{ name = "info", hl = "None", },
{ name = "warn", hl = "WarningMsg", },
{ name = "error", hl = "ErrorMsg", },
{ name = "fatal", hl = "ErrorMsg", },
},
-- Can limit the number of decimals displayed for floats
float_precision = 0.01,
}
Installation
There are two ways to install.
Standalone
The first is simply copying the zero-dependency log.lua file into your project. It is recommended that you place this file within a subdirectory of your lua project. After pasting into your project, change the values in the config table at the top of the file.
For example, for my_cool_plugin, you should place log.lua in my_cool_plugin/log.lua and require it with require('my_cool_plugin.log').
local log = require('my_cool_plugin.log')
log.info("Doing some logging")
Neovim Plugin
You can also install this as a plugin (to get any updates) by using your favorite neovim plugin manager.
After doing so, you can use log.new to generate a new logger for your plugin.
-- In my_plugin/log.lua
return require('vlog').new {
plugin = 'my_cool_plugin',
}
-- In my_plug/other_file.lua
local log = require('my_plugin.log')
log.info("Doing some logging stuff")
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
