112112--- Main logging function
113113--- @param message string
114114--- @param level integer
115- --- @param opts ? { title ?: string , once ?: boolean , file_only ?: boolean , notify_only ?: boolean }
115+ --- @param opts ? { title ?: string , once ?: boolean , file ?: boolean , notify ?: boolean }
116116function M .log (message , level , opts )
117117 opts = opts or {}
118118
@@ -126,16 +126,14 @@ function M.log(message, level, opts)
126126 return
127127 end
128128
129- -- Console notification
130- if config .log .notify and not opts .file_only then
129+ if opts .notify then
131130 vim .notify (message , level , {
132131 title = opts .title or " ECA" ,
133132 once = opts .once ,
134133 })
135134 end
136135
137- -- File logging
138- if config .log .file and not opts .notify_only then
136+ if opts .file then
139137 local log_path = resolve_log_path (config .log .file )
140138 if log_path then
141139 -- Ensure parent directory exists
@@ -161,28 +159,28 @@ end
161159
162160--- Log debug message
163161--- @param message string
164- --- @param opts ? { title ?: string , once ?: boolean , file_only ?: boolean , notify_only ?: boolean }
162+ --- @param opts ? { title ?: string , once ?: boolean , file ?: boolean , notify ?: boolean }
165163function M .debug (message , opts )
166164 M .log (message , vim .log .levels .DEBUG , opts )
167165end
168166
169167--- Log info message
170168--- @param message string
171- --- @param opts ? { title ?: string , once ?: boolean , file_only ?: boolean , notify_only ?: boolean }
169+ --- @param opts ? { title ?: string , once ?: boolean , file ?: boolean , notify ?: boolean }
172170function M .info (message , opts )
173171 M .log (message , vim .log .levels .INFO , opts )
174172end
175173
176174--- Log warn message
177175--- @param message string
178- --- @param opts ? { title ?: string , once ?: boolean , file_only ?: boolean , notify_only ?: boolean }
176+ --- @param opts ? { title ?: string , once ?: boolean , file ?: boolean , notify ?: boolean }
179177function M .warn (message , opts )
180178 M .log (message , vim .log .levels .WARN , opts )
181179end
182180
183181--- Log error message
184182--- @param message string
185- --- @param opts ? { title ?: string , once ?: boolean , file_only ?: boolean , notify_only ?: boolean }
183+ --- @param opts ? { title ?: string , once ?: boolean , file ?: boolean , notify ?: boolean }
186184function M .error (message , opts )
187185 M .log (message , vim .log .levels .ERROR , opts )
188186end
0 commit comments