awful.util.deprecate: add source function name to warning

Closes https://github.com/awesomeWM/awesome/pull/342.
This commit is contained in:
Daniel Hahler 2015-07-23 21:51:42 +02:00
parent f12f9b3b97
commit 292b95da01
1 changed files with 6 additions and 2 deletions

View File

@ -40,11 +40,15 @@ function util.deprecate(see)
return
end
displayed_deprecations[tb] = true
io.stderr:write("W: awful: function is deprecated")
-- Get function name/desc from caller.
local info = debug.getinfo(2, "n")
local funcname = info.name or "?"
io.stderr:write("W: awful: function " .. funcname .. " is deprecated")
if see then
io.stderr:write(", see " .. see)
end
io.stderr:write("\n" .. tb .. "\n")
io.stderr:write(".\n" .. tb .. "\n")
end
--- Strip alpha part of color.