mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 20:55:50 +00:00
Add a dev settings feature, keyed off codename right now
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
local DevSettings = require(script.Parent.DevSettings)
|
||||
|
||||
local testLogLevel = nil
|
||||
local configValue = game:FindFirstChild("ROJO_LOG")
|
||||
|
||||
local Level = {
|
||||
Error = 0,
|
||||
@@ -17,32 +18,37 @@ local function getLogLevel()
|
||||
return _G.ROJO_LOG
|
||||
end
|
||||
|
||||
if configValue ~= nil then
|
||||
return configValue.Value
|
||||
local hyperValue = DevSettings:getLogLevel()
|
||||
if hyperValue ~= nil then
|
||||
return hyperValue
|
||||
end
|
||||
|
||||
return Level.Info
|
||||
end
|
||||
|
||||
local function addTags(tag, message)
|
||||
return tag .. message:gsub("\n", "\n" .. tag)
|
||||
end
|
||||
|
||||
local Log = {}
|
||||
|
||||
Log.Level = Level
|
||||
|
||||
function Log.trace(template, ...)
|
||||
if getLogLevel() >= Level.Trace then
|
||||
print("[Rojo-Trace] " .. string.format(template, ...))
|
||||
print(addTags("[Rojo-Trace] ", string.format(template, ...)))
|
||||
end
|
||||
end
|
||||
|
||||
function Log.info(template, ...)
|
||||
if getLogLevel() >= Level.Info then
|
||||
print("[Rojo-Info] " .. string.format(template, ...))
|
||||
print(addTags("[Rojo-Info] ", string.format(template, ...)))
|
||||
end
|
||||
end
|
||||
|
||||
function Log.warn(template, ...)
|
||||
if getLogLevel() >= Level.Warning then
|
||||
warn("[Rojo-Warn] " .. string.format(template, ...))
|
||||
warn(addTags("[Rojo-Warn] ", string.format(template, ...)))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user