CLog

From Turtle WoW Wiki
Revision as of 22:08, 17 May 2025 by >Basedturtle (Created page with "CLog records combat and chat events into a log file. It helps players analyze combat interactions, chat occurrences, and other in-game events. == Installation == '''GitAddonsManager''' The easiest way to keep '''CLog''' up to date is by using GitAddonsManager. # '''Add the Repository:''' Add the following URL to GitAddonsManager: https://github.com/Cabro/CLog.git # '''Select the Branch:''' Ensure that the master branch is selected. # '''Update:''' Using GitAddonsM...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

CLog records combat and chat events into a log file. It helps players analyze combat interactions, chat occurrences, and other in-game events.

Installation

GitAddonsManager

The easiest way to keep CLog up to date is by using GitAddonsManager.

  1. Add the Repository: Add the following URL to GitAddonsManager: https://github.com/Cabro/CLog.git
  2. Select the Branch: Ensure that the master branch is selected.
  3. Update: Using GitAddonsManager, you can check for and install updates for all your AddOns with a single click.

Manual Installation

If you prefer manual installation, follow these steps:

  1. Go to the main page of the repository.
  2. Click the <> Code dropdown and download the repository as a .zip.
  3. Unpack the .zip and rename the folder to CLog, removing the -master suffix.
  4. Move the folder into your Interface/AddOns directory and restart the game.



Git Links



Commands

Command Description
/clog Toggle combat logging on or off. Starts or stops recording.
/clog clear Clears the current combat log entries.


Notes:

  • When recording is active, events such as combat, NPC speech, emotes, and other chat messages are logged with timestamps.
  • Log files are saved in your SavedVariables folder (WTF\Account\ACCOUNTNAME\SavedVariables\CLog.lua).


Registering Events:<syntaxhighlight lang="lua"> function CLog_Register()

 -- Register all desired events for logging
 -- (see your existing CLog_Register function for full list)

end </syntaxhighlight>Unregistering Events: <syntaxhighlight lang="lua"> function CLog_Unregister()

 -- Unregister all events
 -- (see your existing CLog_Unregister function)

end </syntaxhighlight>



Preview

Log file:



Optimization

Event Registration Optimization

Instead of calling RegisterEvent for each event separately, define all event strings in a table and register/unregister them in a loop. This reduces code duplication and improves maintainability.

Example:<syntaxhighlight lang="lua"> local CLogEventsList = {

 "PLAYER_REGEN_ENABLED",
 "PLAYER_REGEN_DISABLED",
 "CHAT_MSG_MONSTER_SAY",
 "CHAT_MSG_MONSTER_YELL",
 -- add all other event strings here

} </syntaxhighlight>


Registering:<syntaxhighlight lang="lua"> local function CLog_Register()

 for _, event in ipairs(CLogEventsList) do
   CLogFrame:RegisterEvent(event)
 end

end

local function CLog_Unregister()

 for _, event in ipairs(CLogEventsList) do
   CLogFrame:UnregisterEvent(event)
 end

end </syntaxhighlight>