CustomLog
Internal-only instance that writes text to a file in the engine's logs directory.
| Memory category | Instances |
|---|
Member index 4
Description
Internal-only (InternalTest security); not available to ordinary experience
scripts. CustomLog writes text to a file in the engine's logs
directory: CustomLog:Open() creates a file named after the instance's
Instance.Name (with a .log extension),
CustomLog:WriteAppend() appends text, and CustomLog:Close()
closes the file handle. The instance cannot be parented to or contain other
instances.
History 5
- 661 Add WriteAppend
- 661 Add Open
- 661 Add GetLogPath
- 661 Add Close
- 661 Add CustomLog
Members 4
Close
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
| Returns (1) | ||
| null | ||
Closes the file handle previously opened by CustomLog:Open(). Closing an already-closed log has no effect.
| Thread safety | Unsafe |
|---|
GetLogPath
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
| Returns (1) | ||
| string | ||
Returns the full filesystem path of the log file targeted by CustomLog:Open(). The path is set when CustomLog:Open() is called and is derived from the instance's Instance.Name; it is empty before the log has been opened.
| Thread safety | Unsafe |
|---|
History 1
- 661 Add GetLogPath
Open
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
| Returns (1) | ||
| null | ||
Opens a file named after the instance's Instance.Name (with a
.log extension) in the engine's logs directory, truncating any existing
contents so that writing starts from an empty file.
This method throws a runtime error if the log is already open, if Instance.Name is empty, if the name resolves to a path outside the logs directory, or if the file otherwise fails to open.
| Thread safety | Unsafe |
|---|
WriteAppend
| Parameters (1) | ||
|---|---|---|
| append | string | |
| Returns (1) | ||
| null | ||
Writes append to the end of the open log file. The text is written
verbatim, without adding a trailing newline.
This method throws a runtime error if the log is not open (call CustomLog:Open() first) or if the write fails.
| Thread safety | Unsafe |
|---|
History 1
- 661 Add WriteAppend