feat(logging): rotating log files (#5485)
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
#include <Windows.h>
|
||||
#include <WtsApi32.h>
|
||||
|
||||
// local includes
|
||||
#include "src/logging.h"
|
||||
|
||||
// PROC_THREAD_ATTRIBUTE_JOB_LIST is currently missing from MinGW headers
|
||||
#ifndef PROC_THREAD_ATTRIBUTE_JOB_LIST
|
||||
#define PROC_THREAD_ATTRIBUTE_JOB_LIST ProcThreadAttributeValue(13, FALSE, TRUE, FALSE)
|
||||
@@ -123,10 +126,13 @@ HANDLE OpenLogFileHandle() {
|
||||
GetTempPathW(_countof(log_file_name), log_file_name);
|
||||
wcscat_s(log_file_name, L"sunshine.log");
|
||||
|
||||
// Preserve previous service output before opening the current log.
|
||||
logging::rotate_log_file(log_file_name);
|
||||
|
||||
// The file handle must be inheritable for our child process to use it
|
||||
SECURITY_ATTRIBUTES security_attributes = {sizeof(security_attributes), nullptr, TRUE};
|
||||
|
||||
// Overwrite the old sunshine.log
|
||||
// Create the current sunshine.log
|
||||
return CreateFileW(log_file_name, GENERIC_WRITE, FILE_SHARE_READ, &security_attributes, CREATE_ALWAYS, 0, nullptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user