Runner logging (#8068)

This commit is contained in:
Mykhailo Pylyp
2020-11-18 12:15:14 +02:00
committed by GitHub
parent 60a5c3f946
commit 613d1fdf2a
24 changed files with 464 additions and 7 deletions

View File

@@ -22,4 +22,4 @@ struct GeneralSettings
json::JsonObject load_general_settings();
GeneralSettings get_general_settings();
void apply_general_settings(const json::JsonObject& general_configs, bool save = true);
void start_initial_powertoys();
void start_initial_powertoys();

View File

@@ -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))

View File

@@ -238,6 +238,9 @@
<ProjectReference Include="..\common\common.vcxproj">
<Project>{74485049-c722-400f-abe5-86ac52d929b3}</Project>
</ProjectReference>
<ProjectReference Include="..\common\logger\logger.vcxproj">
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
</ProjectReference>
<ProjectReference Include="..\common\updating\updating.vcxproj">
<Project>{17da04df-e393-4397-9cf0-84dabe11032e}</Project>
</ProjectReference>
@@ -249,6 +252,7 @@
<Manifest Include="PowerToys.exe.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\deps\spdlog.props" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200902.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\..\packages\Microsoft.Windows.ImplementationLibrary.1.0.200902.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />

View File

@@ -244,7 +244,6 @@ BOOL run_settings_non_elevated(LPCWSTR executable_path, LPWSTR executable_args,
return process_created;
}
DWORD g_settings_process_id = 0;
void run_settings_window()