Difference between revisions of "OpenUserLog - Debug"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Qazaaq
(game folder is in my documents/my games)
imported>Bug64
m (Extended the example to show writing to the log after opening it)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Scripting]]
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Papyrus]]
[[Category:Non-delayed Native Function]]
'''Member of:''' [[Debug Script]]
'''Member of:''' [[Debug Script]]


Line 11: Line 12:


== Parameters ==
== Parameters ==
*asLogName: The name of the log to open, case-insensitive. User log names may use any combination of letters, numbers, spaces, and underscores ("_").
*asLogName: The name of the log to open, case-insensitive. User log names may use any combination of letters, numbers, and underscores ("_").


== Return Value ==
== Return Value ==
Line 20: Line 21:
; Opens a new user log name "myUserLog"
; Opens a new user log name "myUserLog"
Debug.OpenUserLog("myUserLog")
Debug.OpenUserLog("myUserLog")
; Outputs "Hello World" to the "myUserLog" log
Debug.TraceUser("myUserLog", "Hello World")
</source>
</source>
== Notes ==
*A new log file is created each game session (a session ends when the game is no longer running).
*Multiple scripts and plugins can write to the same logfile.


== See Also ==
== See Also ==

Latest revision as of 16:51, 10 August 2015

Member of: Debug Script

Opens a new user log on disk. This will also cycle the older logs (so log 0 becomes 1, 1 becomes 2, etc). The log files are stored in "My Documents/My Games/Skyrim/Logs/Script/User". If the log is already open, the function will return false (but not print an error to the main script log). Note that you do not have to close the log yourself unless you want to, it will close automatically when the game ends, the player goes back to the main menu, or a save is loaded.

Syntax[edit | edit source]

bool Function OpenUserLog(string asLogName) native global

Parameters[edit | edit source]

  • asLogName: The name of the log to open, case-insensitive. User log names may use any combination of letters, numbers, and underscores ("_").

Return Value[edit | edit source]

True if the log was successfully opened. False if the name was invalid, or the log was already open.

Examples[edit | edit source]

; Opens a new user log name "myUserLog"
Debug.OpenUserLog("myUserLog")

; Outputs "Hello World" to the "myUserLog" log
Debug.TraceUser("myUserLog", "Hello World")

Notes[edit | edit source]

  • A new log file is created each game session (a session ends when the game is no longer running).
  • Multiple scripts and plugins can write to the same logfile.

See Also[edit | edit source]