View Single Post
08/11/21, 04:18 AM   #14
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,980
I think CHAT_ROUTER is used in d() so this makes no difference:
https://github.com/esoui/esoui/blob/...gutils.lua#L36

Code:
...
if CHAT_ROUTER then
        CHAT_ROUTER:AddDebugMessage(text)
...
And Zeni does not recommand anything. d() was meant to be used for debug messages (as d for debug already tells us ) and not "normal addon output" to chat. But we all mostly used it for exatcly that purpose, where othr ways would have been the correct ones.
So if we create /change addons we should not stick to d() anymore but use e.g.
Code:
ZO_ChatRouter:FormatAndAddChatMessage(event, messageText)
The same is sued for system and debug messages, only with the fixed event = "AddSystemMessage".
Normal chat messages run through that formatting function as well with the event = the event used like group joined, etc.
See a list here:
https://github.com/esoui/esoui/blob/...hatdata.lua#L1

The old way was to use CHAT_SYSTEM:AddMessage(messageText) which now points to CHAT_ROUTER:AddSystemMessage()
https://github.com/esoui/esoui/blob/...iases.lua#L820
So this is kinda the same like using d(), because

d() does:
Code:
EmitMessage -> ZO_ChatRouter:AddDebugMessage
function ZO_ChatRouter:AddDebugMessage(messageText)
    self:AddSystemMessage(messageText)
end
And LibChatMessage defines an even better way where you can output messages related to your addon with a defined prefix and other features.

In total I'm not concerned if d() is "abused", but there often had been trouble as d() uses the system channel and some addons suppress system messages. So an alternative output, to normal chat channels, or via LbChatMessage or even LibDebugLogger would be better imo.
  Reply With Quote