Skip to content

Commit

Permalink
Updated colouring scheme of debug module
Browse files Browse the repository at this point in the history
* colours now also used in console (check non-legacymod servers whether this works correctly)
* slightly different colouring scheme for console to increase readibility
  • Loading branch information
Timo Smit committed Mar 14, 2017
1 parent f3eab54 commit 164e1a4
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions luamods/wolfadmin/util/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,33 @@

local settings = require (wolfa_getLuaPath()..".util.settings")

local SEVERITY_LEVELS = {
local COLOURS_CHAT = {
[1] = "^_", -- termination
[2] = "^1", -- error
[3] = "^8", -- warning
[4] = "^2", -- success
[5] = "^7", -- information
}

local COLOURS_CONSOLE = {
[1] = "^_", -- termination
[2] = "^1", -- error
[3] = "^3", -- warning
[4] = "^2", -- success
[5] = "^7", -- information
}

local neededSeverity = 5

function outputDebug(msg, severity)
local severity = severity or 5

if severity <= neededSeverity then
et.G_Print("[WolfAdmin] "..msg.."\n")
et.G_Print("[WolfAdmin] "..COLOURS_CONSOLE[severity]..msg.."\n")

for playerId = 0, et.trap_Cvar_Get("sv_maxclients") - 1 do
if settings.get("g_debugWolfAdmin") ~= 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..playerId.." \"^:[WolfAdmin DEBUG] "..SEVERITY_LEVELS[severity]..msg.."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..playerId.." \"^:[WolfAdmin DEBUG] "..COLOURS_CHAT[severity]..msg.."\";")
end
end
end
Expand Down

0 comments on commit 164e1a4

Please sign in to comment.