Debug.Log Extensions
Documentation (1.1.9)

◆ LogToFile()

static void Debug.LogToFile ( string  message,
[CanBeNull] string  logFilePath = null,
ClearFile  clearFile = ClearFile.OnSessionStart 
)
static

Appends a message to the end of the log file.

Note that calls to this method will function even in release builds with build stripping enabled. As such it is possible to use this method to log some critical messages manually even if otherwise all logging has been disabled across the project.

Parameters
messageMessage to add to the log file.
logFilePathPath to the log file to which the message should be added.
clearFile
  1. ClearFile.OnSessionStart : The log file is cleared before the message is written to it if this is the first time during this session that LogToFile is called for this logFilePath file path.
  2. ClearFile.Now : The log file is cleared now before the message is written to it.

    This might be an useful if you have a log file dedicated to holding only one type of information like system information or performance metrics, and you want to write all the information at once to the log file, replacing its old contents entirely with each call.

ClearFile.Never : This method call will never clear the log file.

Note that with this option the log file will continue growing larger with each call of this method until it is manually cleared by calling ClearLogFile.