A tiny logging module for Lua.
Important
You should initialize like this
hook.Add("Initialize", "InitLogs", function()
// your stuff here
end)
The lua/autorun/log.lua file should be dropped into an garrysmod/addons/
git clone https://github.com/chadlrnsn/pretty-log.git
log.lua provides 6 functions, each function takes all its arguments, concatenates them into a string then outputs the string to the console and -- if one is set -- the log file:
- log.trace(...)
- log.debug(...)
- log.info(...)
- log.warn(...)
- log.error(...)
- log.fatal(...)
local s = function(s, ss)
local result = s+ss
log.trace(result)
log.debug(result)
log.info(result)
log.warn(result)
log.error(result)
log.fatal(result)
end
s(33, 2)
log.lua provides variables for setting additional options:
Whether colors should be used when outputting to the console, this is true
by
default. If you're using a console which does not support ANSI color escape
codes then this should be disabled.
This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See LICENSE for details.