Home -> LogTargetFile -> OpenLogFile

Description

The OpenLogFile method opens the file that will receive log output.

Usage

bool OpenLogFile(const std::string& filePath, bool append = true);
bool OpenLogFile(const std::wstring& filePath, bool append = true);

// Available when compiling as C++17 or later.
bool OpenLogFile(const std::filesystem::path& filePath, bool append = true);

Argument list

filePath [const std::string&]
The UTF-8 path of the file to open for log output.
filePath [const std::wstring&]
The native wide-character path of the file to open for log output.
filePath [const std::filesystem::path&]
The path of the file to open for log output, when the C++17 overload is available.
append [bool]
Pass true to append to existing file content, or false to truncate it.

Return value

[bool]
true if the file was opened successfully; otherwise false.

See also