13
13
14
14
-- User configuration section
15
15
local default_config = {
16
- -- Name of the plugin. Prepended to log messages
16
+ -- Name of the plugin. Prepended to log messages.
17
17
plugin = " plenary" ,
18
18
19
- -- Should print the output to neovim while running
19
+ -- Should print the output to neovim while running.
20
20
-- values: 'sync','async',false
21
21
use_console = " async" ,
22
22
23
- -- Should highlighting be used in console (using echohl)
23
+ -- Should highlighting be used in console (using echohl).
24
24
highlights = true ,
25
25
26
- -- Should write to a file
26
+ -- Should write to a file.
27
+ -- Default output for logging file is `stdpath("cache")/plugin`.
27
28
use_file = true ,
28
29
29
- -- Should write to the quickfix list
30
+ -- Output file has precedence over plugin, if not nil.
31
+ -- Used for the logging file, if not nil and use_file == true.
32
+ outfile = nil ,
33
+
34
+ -- Should write to the quickfix list.
30
35
use_quickfix = false ,
31
36
32
37
-- Any messages above this level will be logged.
33
38
level = p_debug and " debug" or " info" ,
34
39
35
- -- Level configuration
40
+ -- Level configuration.
36
41
modes = {
37
42
{ name = " trace" , hl = " Comment" },
38
43
{ name = " debug" , hl = " Comment" },
@@ -42,7 +47,7 @@ local default_config = {
42
47
{ name = " fatal" , hl = " ErrorMsg" },
43
48
},
44
49
45
- -- Can limit the number of decimals displayed for floats
50
+ -- Can limit the number of decimals displayed for floats.
46
51
float_precision = 0.01 ,
47
52
}
48
53
@@ -54,7 +59,10 @@ local unpack = unpack or table.unpack
54
59
log .new = function (config , standalone )
55
60
config = vim .tbl_deep_extend (" force" , default_config , config )
56
61
57
- local outfile = string.format (" %s/%s.log" , vim .api .nvim_call_function (" stdpath" , { " cache" }), config .plugin )
62
+ local outfile = vim .F .if_nil (
63
+ config .outfile ,
64
+ string.format (" %s/%s.log" , vim .api .nvim_call_function (" stdpath" , { " cache" }), config .plugin )
65
+ )
58
66
59
67
local obj
60
68
if standalone then
0 commit comments