diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-03-22 16:39:28 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-03-22 16:39:28 +0000 |
commit | 9794c49ceae42113b1b80e53b57745c19ffc66bf (patch) | |
tree | 648daf9c5c6f7a899f604ea75f162ffb129dd039 | |
parent | 5cb235a17d4886a1853e368dafe5557fe1df522f (diff) | |
download | prosody-9794c49ceae42113b1b80e53b57745c19ffc66bf.tar.gz prosody-9794c49ceae42113b1b80e53b57745c19ffc66bf.zip |
util.debug: Add a touch of colour to source locations
-rw-r--r-- | util/debug.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/util/debug.lua b/util/debug.lua index 9d76c795..d63dce1b 100644 --- a/util/debug.lua +++ b/util/debug.lua @@ -19,6 +19,7 @@ do filename = _("bright", "blue"); level_num = _("green"); funcname = _("yellow"); + location = _("yellow"); }; end @@ -143,9 +144,9 @@ function debug._traceback(thread, message, level) local source_desc = (info.short_src == "[C]" and "C code") or info.short_src or "Unknown"; if func_type == " " then func_type = ""; end; if info.short_src == "[C]" then - line = "[ C ] "..func_type.."C function "..(info.name and ("%q"):format(info.name) or "(unknown name)") + line = "[ C ] "..func_type.."C function "..getstring(styles.location, (info.name and ("%q"):format(info.name) or "(unknown name)")); elseif info.what == "main" then - line = "[Lua] "..info.short_src.." line "..info.currentline; + line = "[Lua] "..getstring(styles.location, info.short_src.." line "..info.currentline); else local name = info.name or " "; if name ~= " " then @@ -154,7 +155,7 @@ function debug._traceback(thread, message, level) if func_type == "global " or func_type == "local " then func_type = func_type.."function "; end - line = "[Lua] "..info.short_src.." line "..info.currentline.." in "..func_type..getstring(styles.funcname, name).." defined on line "..info.linedefined; + line = "[Lua] "..getstring(styles.location, info.short_src.." line "..info.currentline).." in "..func_type..getstring(styles.funcname, name).." (defined on line "..info.linedefined..")"; end if source_desc ~= last_source_desc then -- Venturing into a new source, add marker for previous if last_source_desc then |