API:TextLogSetIncrementalSaving
From RoR Wiki
UI Lua API · TextLog functions
Version: WAR 1.4.8
Turns on or off writing each new entry of a text log to a file.
TextLogSetIncrementalSaving(logName, enabled, fileName)
Arguments
- logName
string– Name of the text log.- enabled
boolean–trueto write new entries to the file.- fileName
wstring– Path of the log file, for exampleL"logs/uilog.log".
Returns
Nothing.
Details
- When
fileNamediffers from the file the log already uses, the client opens the new file:- The path must be inside the client's log directory. Otherwise the is not in the log directory error is raised.
- If the file already exists, it must be a UTF-16 file that starts with a byte-order mark. Otherwise the already exists and is not a unicode log file error is raised and the file is left alone.
- Calling again with the same file name does not reopen the file.
- The file is opened even when
enabledisfalse. Entries are written only whileenabledistrueand the log itself is enabled (TextLogSetEnabled). - Each entry is written as one line:
[YY/MM/DD][HH:MM:SS]followed by the filter name and the text, with nothing between them, ended by a carriage return and line feed. The filter name is the name given with TextLogAddFilterType, or nothing. - Only entries added after this call are written. Existing entries are not saved.
enabledmust be a real boolean.
Errors
Error in function call 'TextLogSetIncrementalSaving': Text Log %s does not existError in function call 'TextLogSetIncrementalSaving': File '%s' is not in the log directory '%s'.Error in function call 'TextLogSetIncrementalSaving': File '%s' already exists and is not a unicode log file. You may not write to this file.
Example
From ea_uidebugtools/source/debugwindow.lua:
TextLogSetIncrementalSaving( "UiLog", DebugWindow.Settings.logsOn, L"logs/uilog.log"); TextLogSetEnabled( "UiLog", DebugWindow.Settings.logsOn )
