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.  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.

Summary
TextLogA 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.

Implementation Details

Filter Types

Creation

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()

Filter Types

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().

Adding Entries

Once your log is created, you can add entries to it with the TextLogAddEntry() call from lua.

Output to a file

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().

Display In Game

The TextLog is designed to work with the LogDisplay.

Constants

Text Log Update Types

Values

SystemData.TextLogUpdate.ADDEDEntry added to text log
SystemData.TextLogUpdate.REMOVEDEntry was removed from the text log
SystemData.TextLogUpdate.CLEARText log cleared

Functions

Summary
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.

Functions

TextLogCreate()

Creates a new TextLog.

Parameters

textLogName(string) The name of the TextLog.
entryLimit(number) The maximum number of log entries.

Returns

nilno return value

Notes

  • none

Example

TextLogCreate( "RaidLog" )

TextLogDestroy()

Destroys the specified TextLog.

Parameters

textLogName(string) The name of the TextLog.

Returns

nilno return value

Notes

  • You many only destroy text logs that you have created from Lua with <CreateTextLog()>.

Example

TextLogDestroy( "RaidLog" )

TextLogAddFilterType()

Adds a new filter type to the specified text log.

Parameters

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.

Returns

nilno return value

Notes

  • If you do not to use a filter prefix, use L”” as your parameter.

Example

local RAID_LEADER  = 1
TextLogAddFilterType( "RaidLog", RAID_LEADER, L"Raid Leader: " )

TextLogAddEntry()

Adds a new entry to the specified text log.

Parameters

textLogName(string) The name of the TextLog.
filterId(number) The filter type id for this entry.
text(wstring) The entry text.

Returns

nilno return value

Notes

  • none

Example

local RAID_LEADER  = 1
TextLogAddEntry( "RaidLog", RAID_LEADER, L"Everyone attack now!" )

TextLogAddSingleByteEntry()

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.

Parameters

textLogName(string) The name of the TextLog.
filterId(number) The filter type id for this entry.
text(string) The entry text.

Returns

nilno return value

Notes

  • none

Example

local RAID_LEADER  = 1
TextLogAddSingleByteEntry( "RaidLog", RAID_LEADER, "Everyone attack now!" )

TextLogSetIncrementalSaving()

Sets if the the TextLog should be incrementally saved a file as new entires are added.

Parameters

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.

Returns

nilno return value

Notes

  • If you are turning off incremental saving, you may use a filename of L””.

Example

TextLogSetIncrementalSaving( "RaidLog", RAID_LEADER, "logs/raidlog1.txt" )

TextLogGetIncrementalSaving()

Returns if incremental saving is currently enabled for the specified TextLog.

Parameters

textLogName(string) The name of the TextLog.

Returns

incrementalSavingOnIs incremental saving enabled?

Notes

  • none

Example

local logFileOn = TextLogGetIncrementalSaving( "RaidLog" )

TextLogClear()

Clears the current contents of the TextLog.

Parameters

textLogName(string) The name of the TextLog.

Returns

nilno return value

Notes

Example

TextLogClear( "RaidLog" )

TextLogSaveLog()

Saves the current contents of the TextLog out to the specified file.

Parameters

textLogName(string) The name of the TextLog.
filePath(string) The path of the file to use.

Returns

nilno return value

Notes

  • If you are turning off incremental saving, you may use a filename of L””.

Example

TextLogSaveLog( "RaidLog", "logs/SomeDungon_July5th.txt" )

TextLogLoadFromFile()

Loads in a saved version of the TextLog from disk.

Parameters

textLogName(string) The name of the TextLog.
filePath(string) The path of the file to load from.

Returns

nilno return value

Notes

  • Currently Loading a log file just dumps each line of the log file into the TextLog as an entry of Filter Type 0.  This will not re-parse out the time stamp and filter types.

Example

TextLogLoadFromFile( "RaidHistory", "logs/SomeDungon_July5th.txt" )

TextLogSetEnabled()

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.

Parameters

textLogName(string) The name of the TextLog.
isEnabled(boolean) Should the log be enabled?

Returns

nilno return value

Notes

  • All logs default to enabled when created with TextLogCreate().  Logs created internally by the game may not be enabled by default.  You can check their status by calling TextLogGetEnabled().

Example

TextLogSetEnabled( "RaidLog", true )

TextLogGetEnabled()

Returns if the log is currently enabled.

Parameters

textLogName(string) The name of the TextLog.

Returns

isEnabled(boolean) Is the log be enabled?

Notes

  • All logs default to enabled when created with TextLogCreate().  Logs created internally by the game may not be enabled by default.

Example

local logOn = TextLogGetEnabled( "RaidLog", true )

TextLogGetNumEntries()

Returns the number of entires currently in the TextLog.

Parameters

textLogName(string) The name of the TextLog.

Returns

numEntries(number) The number of entries currently in the log.

Notes

  • none

Example

local numEntries = TextLogGetNumEntries( "RaidLog",)

TextLogGetEntry()

Returns the data for a particular entry id.

Parameters

textLogName(string) The name of the TextLog.
entryIndex(number) Th entry index number (between 1 and TextLogGetNumEntries)

Returns

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.

Notes

  • none

Example

local timestamp, filterType, entryText = TextLogGetEntry( "RaidLog", 54 )

TextLogGetUpdateEventId()

Returns the event id broadcast when this text log is updated.

Parameters

textLogName(string) The name of the TextLog.

Returns

eventId(number) The event id.

Notes

  • none

Example

local chatUpdateEvent = TextLogGetUpdateEventId( "Chat" )
The LogDisplay provides a scrolling display to view any number of TextLogs.
Creates a new TextLog.
Destroys the specified TextLog.
Adds a new filter type to the specified text log.
Adds a new entry to the specified text log.
Sets if the the TextLog should be incrementally saved a file as new entires are added.
Saves the current contents of the TextLog out to the specified file.
Returns if the log is currently enabled.