1313
1414-- User configuration section
1515local default_config = {
16- -- Name of the plugin. Prepended to log messages
16+ -- Name of the plugin. Prepended to log messages.
1717 plugin = " plenary" ,
1818
19- -- Should print the output to neovim while running
19+ -- Should print the output to neovim while running.
2020 -- values: 'sync','async',false
2121 use_console = " async" ,
2222
23- -- Should highlighting be used in console (using echohl)
23+ -- Should highlighting be used in console (using echohl).
2424 highlights = true ,
2525
26- -- Should write to a file
26+ -- Should write to a file.
27+ -- Default output for logging file is `stdpath("cache")/plugin`.
2728 use_file = true ,
2829
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.
3035 use_quickfix = false ,
3136
3237 -- Any messages above this level will be logged.
3338 level = p_debug and " debug" or " info" ,
3439
35- -- Level configuration
40+ -- Level configuration.
3641 modes = {
3742 { name = " trace" , hl = " Comment" },
3843 { name = " debug" , hl = " Comment" },
@@ -42,7 +47,7 @@ local default_config = {
4247 { name = " fatal" , hl = " ErrorMsg" },
4348 },
4449
45- -- Can limit the number of decimals displayed for floats
50+ -- Can limit the number of decimals displayed for floats.
4651 float_precision = 0.01 ,
4752}
4853
@@ -54,7 +59,10 @@ local unpack = unpack or table.unpack
5459log .new = function (config , standalone )
5560 config = vim .tbl_deep_extend (" force" , default_config , config )
5661
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+ )
5866
5967 local obj
6068 if standalone then
0 commit comments