Chatplus: better logging
This commit is contained in:
parent
a43bcc78af
commit
28dae53bfc
1 changed files with 9 additions and 8 deletions
|
@ -37,6 +37,11 @@ function chatplus.setting(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function chatplus.log(msg)
|
||||||
|
chatplus.log_handle:write(os.date("%d/%m/%Y %I:%M%p") .. " " .. msg .. "\r\n")
|
||||||
|
chatplus.log_handle:flush()
|
||||||
|
end
|
||||||
|
|
||||||
function chatplus.load()
|
function chatplus.load()
|
||||||
-- Initialize the log
|
-- Initialize the log
|
||||||
if chatplus.setting("log") then
|
if chatplus.setting("log") then
|
||||||
|
@ -46,6 +51,7 @@ function chatplus.load()
|
||||||
else
|
else
|
||||||
minetest.log("action","Logging chat plus to: "..chatplus.log_file)
|
minetest.log("action","Logging chat plus to: "..chatplus.log_file)
|
||||||
end
|
end
|
||||||
|
chatplus.log("*** SERVER STARTED ***")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Load player data
|
-- Load player data
|
||||||
|
@ -142,13 +148,8 @@ function chatplus.send(from, msg)
|
||||||
|
|
||||||
-- Log chat message
|
-- Log chat message
|
||||||
if chatplus.log_handle ~= nil then
|
if chatplus.log_handle ~= nil then
|
||||||
chatplus.log_handle:write(
|
local tname = ctf.player(from).team or ""
|
||||||
os.date("%Y/%m/%d %I:%M%p")..
|
chatplus.log(tname .. "<" .. from .. "> " .. msg)
|
||||||
" <"..from.."> "..
|
|
||||||
msg..
|
|
||||||
"\r\n"
|
|
||||||
)
|
|
||||||
chatplus.log_handle:flush()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Loop through senders
|
-- Loop through senders
|
||||||
|
|
Loading…
Reference in a new issue