Logging: fixed not showing mod name and msg type in chat

This commit is contained in:
bi 2018-05-28 22:43:31 +03:00
parent 1ac6a25024
commit f30c158fb3

View file

@ -22,7 +22,11 @@ local function safe_format(mod, str, ...)
end end
local function send_to_chat(message) local function send_to_chat(self, msg_type, message)
if msg_type ~= "echo" then
message = string.format("[%s][%s] %s", self:get_name(), string.upper(msg_type), message)
end
if Managers.chat and Managers.chat:has_channel(1) then if Managers.chat and Managers.chat:has_channel(1) then
Managers.chat:add_local_system_message(1, message, true) Managers.chat:add_local_system_message(1, message, true)
@ -43,7 +47,7 @@ local function log_message(self, msg_type, message, ...)
if message then if message then
if _LOGGING_SETTINGS[msg_type].send_to_chat then if _LOGGING_SETTINGS[msg_type].send_to_chat then
send_to_chat(message) send_to_chat(self, msg_type, message)
end end
if _LOGGING_SETTINGS[msg_type].send_to_log then if _LOGGING_SETTINGS[msg_type].send_to_log then