mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Enable stdout logging for all UWP builds
This commit is contained in:
parent
c0a582471e
commit
337791d4b1
1 changed files with 13 additions and 23 deletions
|
@ -221,30 +221,20 @@ Servo::Servo(hstring args, GLsizei width, GLsizei height,
|
||||||
|
|
||||||
sServo = this; // FIXME;
|
sServo = this; // FIXME;
|
||||||
|
|
||||||
#ifndef _DEBUG
|
auto current = ApplicationData::Current();
|
||||||
char buffer[1024];
|
auto filePath = std::wstring(current.LocalFolder().Path()) + L"\\stdout.txt";
|
||||||
bool logToFile = GetEnvironmentVariableA("FirefoxRealityLogStdout", buffer,
|
sLogHandle =
|
||||||
sizeof(buffer)) != 0;
|
CreateFile2(filePath.c_str(), GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr);
|
||||||
#else
|
if (sLogHandle == INVALID_HANDLE_VALUE) {
|
||||||
bool logToFile = true;
|
throw std::runtime_error("Failed to open the log file: error code " +
|
||||||
#endif
|
std::to_string(GetLastError()));
|
||||||
if (logToFile) {
|
}
|
||||||
auto current = ApplicationData::Current();
|
|
||||||
auto filePath =
|
|
||||||
std::wstring(current.LocalFolder().Path()) + L"\\stdout.txt";
|
|
||||||
sLogHandle =
|
|
||||||
CreateFile2(filePath.c_str(), GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr);
|
|
||||||
if (sLogHandle == INVALID_HANDLE_VALUE) {
|
|
||||||
throw std::runtime_error("Failed to open the log file: error code " +
|
|
||||||
std::to_string(GetLastError()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SetFilePointer(sLogHandle, 0, nullptr, FILE_END) ==
|
if (SetFilePointer(sLogHandle, 0, nullptr, FILE_END) ==
|
||||||
INVALID_SET_FILE_POINTER) {
|
INVALID_SET_FILE_POINTER) {
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
"Failed to set file pointer to the end of file: error code " +
|
"Failed to set file pointer to the end of file: error code " +
|
||||||
std::to_string(GetLastError()));
|
std::to_string(GetLastError()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
capi::CHostCallbacks c;
|
capi::CHostCallbacks c;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue