diff options
Diffstat (limited to 'gamemode/shared/log.lua')
| -rw-r--r-- | gamemode/shared/log.lua | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/gamemode/shared/log.lua b/gamemode/shared/log.lua index 618fd0c..24fe58f 100644 --- a/gamemode/shared/log.lua +++ b/gamemode/shared/log.lua @@ -1,7 +1,11 @@ +--- Logging utility. +-- This prints things to the console for now, maybe it can automatically file bugs and save bug reports in the future? +--@module log.lua + +local log = {} local fn = nrequire("fn.lua") local col = nrequire("colortheme.lua") -local log = {} local domain if SERVER then domain = "[SERVER]" @@ -9,20 +13,30 @@ elseif CLIENT then domain = "[CLIENT]" end +--- Print a debug message. +-- This can be suppressed in release versions function log.debug(...) - MsgC(col.console.gray,domain,"[DEBUG]",...,"\n") + MsgC(col.console.gray,domain,"[DEBUG]",table.concat({...}," "),"\n") end +--- Print an information message. +-- Things server owners might want to see function log.info(...) - MsgC(col.console.cyan,domain,"[INFO]",...,"\n") + MsgC(col.console.cyan,domain,"[INFO]",table.concat({...}," "),"\n") end +--- Prints a warning. +-- Things developers need to look at +-- Maybe print this to a file in the future? function log.warn(...) - MsgC(col.console.yellow,domain,"[WARNING]",...,"\n") + MsgC(col.console.yellow,domain,"[WARNING]",table.concat({...}," "),"\n") end +--- Prints an error. +-- Things that should never happen +-- Maybe have this automatically make bugs on the bug tracker with the above log files? function log.error(...) - MsgC(col.console.red,domain,"[ERROR]",...,"\n") + MsgC(col.console.red,domain,"[ERROR]",table.concat({...}," "),"\n") end log.report = fn.curry( |
