Add logging for PowerRename (#14249)

* Add logging for PowerRename

Move call tracer to common/utils/logger
Add logging to both PowerRename dll and PowerRenameUIHost
Add PowerRename to BugReportTool event viewer collection

* Log more errors and exceptions
This commit is contained in:
Stefan Markovic
2021-11-08 13:02:56 +01:00
committed by GitHub
parent c9dca6802e
commit 079a3b49de
16 changed files with 177 additions and 53 deletions

View File

@@ -54,6 +54,9 @@
<ProjectReference Include="..\..\..\common\Display\Display.vcxproj">
<Project>{caba8dfb-823b-4bf2-93ac-3f31984150d9}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
</ProjectReference>
@@ -65,6 +68,7 @@
<None Include="Resources.resx" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\..\..\deps\spdlog.props" />
<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\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" />

View File

@@ -4,6 +4,8 @@
#include <settings.h>
#include <trace.h>
#include <common/SettingsAPI/settings_objects.h>
#include <common/logger/logger.h>
#include <common/utils/logger_helper.h>
#include <common/utils/resources.h>
#include "Generated Files/resource.h"
#include <atomic>
@@ -174,6 +176,7 @@ public:
// Enable the powertoy
virtual void enable()
{
Logger::info(L"PowerRename enabled");
m_enabled = true;
save_settings();
}
@@ -181,6 +184,7 @@ public:
// Disable the powertoy
virtual void disable()
{
Logger::info(L"PowerRename disabled");
m_enabled = false;
save_settings();
}
@@ -261,9 +265,9 @@ public:
Trace::SettingsChanged();
}
catch (std::exception)
catch (std::exception e)
{
// Improper JSON.
Logger::error("Configuration parsing failed: {}", std::string{ e.what() });
}
}
@@ -297,6 +301,7 @@ public:
init_settings();
app_name = GET_RESOURCE_STRING(IDS_POWERRENAME_APP_NAME);
app_key = PowerRenameConstants::ModuleKey;
LoggerHelpers::init_logger(app_key, L"ModuleInterface", LogSettings::powerRenameLoggerName);
}
~PowerRenameModule(){};