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

@@ -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(){};