From 38a05e947d041f8b9c42e49eb075b972a7e9355c Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Tue, 7 Nov 2017 00:07:35 -0500 Subject: Added luadocs for shared libraries Started working on documentation --- gamemode/shared/log.lua | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'gamemode/shared/log.lua') 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( -- cgit v1.2.3-70-g09d2