A TextLog is exactly what it sounds like,a method of logging text entires, that you can either output to a file on disk or display in LogDisplay on screen. When create a TextLog, you must specify filter types for the entries that it will include. You may have as few or as many filter types as you wish.
TextLog | A TextLog is exactly what it sounds like,a method of logging text entires, that you can either output to a file on disk or display in LogDisplay on screen. |
Implementation Details | |
Constants | |
Text Log Update Types | |
Functions | |
Functions | |
TextLogCreate() | Creates a new TextLog. |
TextLogDestroy() | Destroys the specified TextLog. |
TextLogAddFilterType() | Adds a new filter type to the specified text log. |
TextLogAddEntry() | Adds a new entry to the specified text log. |
TextLogAddSingleByteEntry() | Adds a new entry to the specified text log. |
TextLogSetIncrementalSaving() | Sets if the the TextLog should be incrementally saved a file as new entires are added. |
TextLogGetIncrementalSaving() | Returns if incremental saving is currently enabled for the specified TextLog. |
TextLogClear() | Clears the current contents of the TextLog. |
TextLogSaveLog() | Saves the current contents of the TextLog out to the specified file. |
TextLogLoadFromFile() | Loads in a saved version of the TextLog from disk. |
TextLogSetEnabled() | Sets if the log is currently enabled. |
TextLogGetEnabled() | Returns if the log is currently enabled. |
TextLogGetNumEntries() | Returns the number of entires currently in the TextLog. |
TextLogGetEntry() | Returns the data for a particular entry id. |
TextLogGetUpdateEventId() | Returns the event id broadcast when this text log is updated. |
Each TextLog is created with a specfic name. The game may have a number of TextLogs created internally for things like a chat log or combat log. You may also create your own logs through lua by calling TextLogCreate(). Note that unlike windows, TextLogs are not automatically destroyed when you reload the UI. If you wish to destroy a TextLog that you have created, you must call TextLogDestroy()
Once you have created a text log, you must add some filter types. Filter Types are unique index numbers that identify different types of entries in the log these filter types are used by the LogDisplay to hide/show different content and to set text colors.
When you create a filter type, you may also specify a prefix that will be prepended to all entires of that type when it is displayed. You can specify filter types with the TextLogAddFilterType().
Once your log is created, you can add entries to it with the TextLogAddEntry() call from lua.
You can automatically write a text log to a file by calling TextLogSetIncrementalSaving() with a valid filename. If you wish to manually save the log once, rather than continously save out each entry, you can call TextLogSaveLog().
The TextLog is designed to work with the LogDisplay.
Functions | |
TextLogCreate() | Creates a new TextLog. |
TextLogDestroy() | Destroys the specified TextLog. |
TextLogAddFilterType() | Adds a new filter type to the specified text log. |
TextLogAddEntry() | Adds a new entry to the specified text log. |
TextLogAddSingleByteEntry() | Adds a new entry to the specified text log. |
TextLogSetIncrementalSaving() | Sets if the the TextLog should be incrementally saved a file as new entires are added. |
TextLogGetIncrementalSaving() | Returns if incremental saving is currently enabled for the specified TextLog. |
TextLogClear() | Clears the current contents of the TextLog. |
TextLogSaveLog() | Saves the current contents of the TextLog out to the specified file. |
TextLogLoadFromFile() | Loads in a saved version of the TextLog from disk. |
TextLogSetEnabled() | Sets if the log is currently enabled. |
TextLogGetEnabled() | Returns if the log is currently enabled. |
TextLogGetNumEntries() | Returns the number of entires currently in the TextLog. |
TextLogGetEntry() | Returns the data for a particular entry id. |
TextLogGetUpdateEventId() | Returns the event id broadcast when this text log is updated. |
Creates a new TextLog.
textLogName | (string) The name of the TextLog. |
entryLimit | (number) The maximum number of log entries. |
nil | no return value |
TextLogCreate( "RaidLog" )
Destroys the specified TextLog.
textLogName | (string) The name of the TextLog. |
nil | no return value |
TextLogDestroy( "RaidLog" )
Adds a new filter type to the specified text log.
textLogName | (string) The name of the TextLog. |
filterId | (number) The unique ID number for this filter type. |
filterPrefix | (wstring) The text to be pre-pended to entries of this type. |
nil | no return value |
local RAID_LEADER = 1
TextLogAddFilterType( "RaidLog", RAID_LEADER, L"Raid Leader: " )
Adds a new entry to the specified text log.
textLogName | (string) The name of the TextLog. |
filterId | (number) The filter type id for this entry. |
text | (wstring) The entry text. |
nil | no return value |
local RAID_LEADER = 1
TextLogAddEntry( "RaidLog", RAID_LEADER, L"Everyone attack now!" )
Adds a new entry to the specified text log. This is the single-byte text version of this call. The text is converted to wide-string internally for output.
textLogName | (string) The name of the TextLog. |
filterId | (number) The filter type id for this entry. |
text | (string) The entry text. |
nil | no return value |
local RAID_LEADER = 1
TextLogAddSingleByteEntry( "RaidLog", RAID_LEADER, "Everyone attack now!" )
Sets if the the TextLog should be incrementally saved a file as new entires are added.
textLogName | (string) The name of the TextLog. |
incrementalSavingOn | (number) Should the log file be saved incrementally? |
filePath | (string) The path of the file to use. |
nil | no return value |
TextLogSetIncrementalSaving( "RaidLog", RAID_LEADER, "logs/raidlog1.txt" )
Returns if incremental saving is currently enabled for the specified TextLog.
textLogName | (string) The name of the TextLog. |
incrementalSavingOn | Is incremental saving enabled? |
local logFileOn = TextLogGetIncrementalSaving( "RaidLog" )
Clears the current contents of the TextLog.
textLogName | (string) The name of the TextLog. |
nil | no return value |
TextLogClear( "RaidLog" )
Saves the current contents of the TextLog out to the specified file.
textLogName | (string) The name of the TextLog. |
filePath | (string) The path of the file to use. |
nil | no return value |
TextLogSaveLog( "RaidLog", "logs/SomeDungon_July5th.txt" )
Loads in a saved version of the TextLog from disk.
textLogName | (string) The name of the TextLog. |
filePath | (string) The path of the file to load from. |
nil | no return value |
TextLogLoadFromFile( "RaidHistory", "logs/SomeDungon_July5th.txt" )
Sets if the log is currently enabled. When a log is disabled, any calls to TextLogAddEntry() will fail to add the text to the log. Neither the output file nor any registered LogDisplays will show new entries.
textLogName | (string) The name of the TextLog. |
isEnabled | (boolean) Should the log be enabled? |
nil | no return value |
TextLogSetEnabled( "RaidLog", true )
Returns if the log is currently enabled.
textLogName | (string) The name of the TextLog. |
isEnabled | (boolean) Is the log be enabled? |
local logOn = TextLogGetEnabled( "RaidLog", true )
Returns the number of entires currently in the TextLog.
textLogName | (string) The name of the TextLog. |
numEntries | (number) The number of entries currently in the log. |
local numEntries = TextLogGetNumEntries( "RaidLog",)
Returns the data for a particular entry id.
textLogName | (string) The name of the TextLog. |
entryIndex | (number) Th entry index number (between 1 and TextLogGetNumEntries) |
timestamp | (wstring) The timestamp for the entry in the format [YY/MM/DD][HH:MM:SS] |
filterType | (number) The FilterType for the entry. |
text | (wstring) The entry text. |
local timestamp, filterType, entryText = TextLogGetEntry( "RaidLog", 54 )