mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
Runner logging (#8068)
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#if _DEBUG && _WIN64
|
||||
#include "unhandled_exception_handler.h"
|
||||
#endif
|
||||
#include <common\settings_helpers.h>
|
||||
#include <common/logger/logger.h>
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
extern updating::notifications::strings Strings;
|
||||
@@ -43,6 +45,7 @@ namespace
|
||||
const wchar_t POWER_TOYS_MODULE_LOAD_FAIL[] = L"Failed to load "; // Module name will be appended on this message and it is not localized.
|
||||
}
|
||||
|
||||
std::shared_ptr<Logger> logger;
|
||||
void chdir_current_executable()
|
||||
{
|
||||
// Change current directory to the path of the executable.
|
||||
@@ -73,6 +76,7 @@ void open_menu_from_another_instance()
|
||||
|
||||
int runner(bool isProcessElevated)
|
||||
{
|
||||
logger->info("Runner is starting. Elevated={}", isProcessElevated);
|
||||
DPIAware::EnableDPIAwarenessForThisProcess();
|
||||
|
||||
#if _DEBUG && _WIN64
|
||||
@@ -290,6 +294,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::filesystem::path logFilePath(PTSettingsHelper::get_root_save_folder_location());
|
||||
logFilePath = logFilePath.append(L"runner-logging.txt");
|
||||
logger = std::make_shared<Logger>("runner", logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
|
||||
|
||||
int n_cmd_args = 0;
|
||||
LPWSTR* cmd_arg_list = CommandLineToArgvW(GetCommandLineW(), &n_cmd_args);
|
||||
switch (should_run_in_special_mode(n_cmd_args, cmd_arg_list))
|
||||
|
||||
Reference in New Issue
Block a user