added logging to action-runner project (#9034)

This commit is contained in:
Mykhailo Pylyp
2021-01-11 12:51:13 +02:00
committed by GitHub
parent dbda4d50bd
commit 3503ac27a8
3 changed files with 14 additions and 0 deletions

View File

@@ -16,6 +16,10 @@
#include <common/utils/process_path.h> #include <common/utils/process_path.h>
#include <common/utils/resources.h> #include <common/utils/resources.h>
#include <common/SettingsAPI/settings_helpers.h>
#include <common/logger/logger.h>
#include <winrt/Windows.ApplicationModel.h> #include <winrt/Windows.ApplicationModel.h>
#include <winrt/Windows.Storage.h> #include <winrt/Windows.Storage.h>
#include <Msi.h> #include <Msi.h>
@@ -173,6 +177,10 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
} }
std::wstring_view action{ args[1] }; std::wstring_view action{ args[1] };
std::filesystem::path logFilePath(PTSettingsHelper::get_root_save_folder_location());
logFilePath.append(LogSettings::actionRunnerLogPath);
Logger::init(LogSettings::actionRunnerLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
if (action == RUN_NONELEVATED_CMDARG) if (action == RUN_NONELEVATED_CMDARG)
{ {
int nextArg = 2; int nextArg = 2;

View File

@@ -47,6 +47,9 @@
<ClCompile Include="action_runner.cpp" /> <ClCompile Include="action_runner.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\common\logger\logger.vcxproj">
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
</ProjectReference>
<ProjectReference Include="..\common\notifications\notifications.vcxproj"> <ProjectReference Include="..\common\notifications\notifications.vcxproj">
<Project>{1d5be09d-78c0-4fd7-af00-ae7c1af7c525}</Project> <Project>{1d5be09d-78c0-4fd7-af00-ae7c1af7c525}</Project>
</ProjectReference> </ProjectReference>
@@ -69,6 +72,7 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\deps\spdlog.props" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<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')" /> <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')" />
</ImportGroup> </ImportGroup>

View File

@@ -8,6 +8,8 @@ struct LogSettings
inline const static std::wstring logLevelOption = L"logLevel"; inline const static std::wstring logLevelOption = L"logLevel";
inline const static std::string runnerLoggerName = "runner"; inline const static std::string runnerLoggerName = "runner";
inline const static std::wstring runnerLogPath = L"RunnerLogs\\runner-log.txt"; inline const static std::wstring runnerLogPath = L"RunnerLogs\\runner-log.txt";
inline const static std::string actionRunnerLoggerName = "action-runner";
inline const static std::wstring actionRunnerLogPath = L"RunnerLogs\\action-runner-log.txt";
inline const static std::string launcherLoggerName = "launcher"; inline const static std::string launcherLoggerName = "launcher";
inline const static std::wstring launcherLogPath = L"LogsModuleInterface\\launcher-log.txt"; inline const static std::wstring launcherLogPath = L"LogsModuleInterface\\launcher-log.txt";
inline const static std::string fancyZonesLoggerName = "fancyzones"; inline const static std::string fancyZonesLoggerName = "fancyzones";