History

lua: change config file logging

Make the existing "not found" messages debug only, and add a new verbose message if a config file was opened. The idea is that logging should make it apparent whether or not config files are loaded, and it's more common to use scripts without config files, leading to fewer log messages in verbose mode.

wm4 committed 7 years ago

Commit fdce7781 parent 02cb44a1 file · +3 −2Browse files

Showing the changes to player/lua/options.lua (1 of 1 file). Show all

Unified · Split

player/lua/options.lua+3−2
@@ -40,7 +40,7 @@ local function read_options(options, identifier) · 39 unmodified lines
40 local conffilename = "script-opts/" .. identifier .. ".conf"40 local conffilename = "script-opts/" .. identifier .. ".conf"
41 local conffile = mp.find_config_file(conffilename)41 local conffile = mp.find_config_file(conffilename)
42 if conffile == nil then42 if conffile == nil then
43 msg.verbose(conffilename .. " not found.")43 msg.debug(conffilename .. " not found.")
44 conffilename = "lua-settings/" .. identifier .. ".conf"44 conffilename = "lua-settings/" .. identifier .. ".conf"
45 conffile = mp.find_config_file(conffilename)45 conffile = mp.find_config_file(conffilename)
46 if conffile then46 if conffile then
@@ -50,9 +50,10 @@ local function read_options(options, identifier) · 3 unmodified lines
50 local f = conffile and io.open(conffile,"r")50 local f = conffile and io.open(conffile,"r")
51 if f == nil then51 if f == nil then
52 -- config not found52 -- config not found
53 msg.verbose(conffilename .. " not found.")53 msg.debug(conffilename .. " not found.")
54 else54 else
55 -- config exists, read values55 -- config exists, read values
56 msg.verbose("Opened config file " .. conffilename .. ".")
56 local linecounter = 157 local linecounter = 1
57 for line in f:lines() do58 for line in f:lines() do
58 if string.find(line, "#") == 1 then59 if string.find(line, "#") == 1 then

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t