-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.lua
30 lines (26 loc) · 1 KB
/
Logger.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local _, CGM = ...
-- Variables.
local messageType = CGM:Enum({"Debug", "Message"})
-- Logs a message to chat.
local function LogMessage(_messageType, message)
if _messageType == messageType.Debug and CGMOptions.settings.debug then
-- GetTime() is system uptime, but useful for comparing time between events.
print("|cFFFF0000[" .. string.format("%.3f", GetTime()) .. "]: CGM|r: " .. (message and message or "nil"))
elseif _messageType == messageType.Message then
print("|cFFFFFF00ClassicGuideMaker|r: " .. message)
end
end
-- Prints the given message to chat as a debug message.
function CGM:Debug(message)
if CGMOptions.settings.debug then
LogMessage(messageType.Debug, message)
end
end
-- Prints the given message to chat as a message.
function CGM:Message(message)
if CGMOptions.settings.debug then
LogMessage(messageType.Debug, "(message): " .. message)
else
LogMessage(messageType.Message, message)
end
end