Skip to content

Commit

Permalink
fix(logger): create log directory on initialization (fix #226)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-hui committed Mar 20, 2024
1 parent ebb8e44 commit 0d4b47b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/fidget/logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ M.options = {
---@options ]]

require("fidget.options").declare(M, "logger", M.options, function()
-- Create directory where log will reside
vim.fn.mkdir(vim.fn.fnamemodify(M.options.path, ":p:h"), "p")

if M.options.max_size then
-- Simulate opening the log at startup, so that any potential file system
-- issues arise sooner than later. Also forces log to be
-- issues arise sooner than later. Also forces log to be created or pruned.
local log = M.open_log()
if log then
log:close()
Expand Down

0 comments on commit 0d4b47b

Please sign in to comment.