From what I can see, as it is currently written, this plugin will log either zero messages, or every message it sends (1 per player recieved).
Having an option to only log the sent message (which is how the server behaves w/o the plugin) would be preferable to this.
Option to log sent message onlySuggestion
update: ideally, having it only log the different translations it sends, along w/ the original message, or logging the original message and a translation into the server lang would useful, but would probably take a fair amount of effort.
For now, I was able to achieve the result I wanted by putting a modified version of the 'Log' command in the HandleChat method, after the null sender check.
update 2: doing it using the Log command does not output a 'chat' message to the console. For most users this might not matter, but RustAdmin scrapes the console looking for properly formatted chat messages. I got my single chat message log to work by grabbing the Facepunch.RCon.Broadcast commands from the TranslateChat method.
The plugin outputs the correct format when used as written by Wulf. It just outputs multiple messages (one for each receiving user).. My quick and dirty fix to reduce the spam was a little TOO dirty.
Implemented separate options in a branch for you to test:
https://umod.org/plugins/ChatTranslator.cs?version=2.3.0&branch=logging
Sorry, didn't notice your reply earlier.. Thank you for working to add this.
I gave the branched version a quick test and found the following:
1. missing semicolons on lines 152 and 157 (the LogOutput calls)
2. missing channel variable in LogOutput method - added int channel=0 to method params, added channel to method calls
3. missing variable prefixColor in LogOutput method - i just commented that line out
this fixes the rustadmin issue, since the log messages now have the same formatting.. however
4. ( I didn't fix this yet). This still suffers from the original problem with 'Log Translated Messages': since the LogOutput calls are in the ProcessMessage method, they get called for every message the plugin sends (one per connected player). You'd need to move the LogOriginalCheck to the HandleMessage method to avoid this.
Hmm, download isn't showing the correct patch for some reason. Will try to re-do the download.
Moving the translated messages outside of the method defeats the purpose of that option though, because its intended purpose is to log all translated messages, not just one message.
Right, but you wouldn't need to move both calls.
The option to log translated messages should log all translations (although it would be nice if it only logged unique translations). This was my original problem - if 9/10 ppl on the server speak the same language, only 2 messages need to be logged, not 10. However, doing that requires you to go through all the players, get their languages and send the translation, add the translation to a set/list that only holds unique items, and then log the contents of that list. And I'm not sure what that would do to performance (although probably not too much)
However, the option to log the original message should only log one message because there only is one of those.
So THAT check/call would need to move. If you want, I can clean up my version and share it with you (although you'd need to tell me how/where to share it).
I see what you mean now, and I see where I went wrong with the original and made that change. For the unique translations only, storing and checking shouldn't be that involved in terms of performance, which I can take a look at as able or if you want to link me a paste with what you come up with.
I haven't had a chance to look at this, but if/when I do, I'll link a paste. Thanks