Skip to content

Return of Reckoning

Wiki

RoR Wiki

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 – true to write new entries to the file.
fileName
wstring – Path of the log file, for example L"logs/uilog.log".

Returns

Nothing.

Details

  • When fileName differs 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 enabled is false. Entries are written only while enabled is true and 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.
  • enabled must be a real boolean.

Errors

  • Error in function call 'TextLogSetIncrementalSaving': Text Log %s does not exist
  • Error 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 )

See also