mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
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:
@@ -1,53 +0,0 @@
|
||||
#include "pch.h"
|
||||
#include "CallTracer.h"
|
||||
#include <thread>
|
||||
|
||||
namespace
|
||||
{
|
||||
// Non-localizable
|
||||
const std::string entering = " Enter";
|
||||
const std::string exiting = " Exit";
|
||||
|
||||
std::mutex indentLevelMutex;
|
||||
std::map<std::thread::id, int> indentLevel;
|
||||
|
||||
std::string GetIndentation()
|
||||
{
|
||||
std::unique_lock lock(indentLevelMutex);
|
||||
int level = indentLevel[std::this_thread::get_id()];
|
||||
|
||||
if (level <= 0)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string(2 * min(level, 64) - 1, ' ') + " - ";
|
||||
}
|
||||
}
|
||||
|
||||
void Indent()
|
||||
{
|
||||
std::unique_lock lock(indentLevelMutex);
|
||||
indentLevel[std::this_thread::get_id()]++;
|
||||
}
|
||||
|
||||
void Unindent()
|
||||
{
|
||||
std::unique_lock lock(indentLevelMutex);
|
||||
indentLevel[std::this_thread::get_id()]--;
|
||||
}
|
||||
}
|
||||
|
||||
CallTracer::CallTracer(const char* functionName) :
|
||||
functionName(functionName)
|
||||
{
|
||||
Logger::trace((GetIndentation() + functionName + entering).c_str());
|
||||
Indent();
|
||||
}
|
||||
|
||||
CallTracer::~CallTracer()
|
||||
{
|
||||
Unindent();
|
||||
Logger::trace((GetIndentation() + functionName + exiting).c_str());
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/logger/logger.h"
|
||||
|
||||
#define _TRACER_ CallTracer callTracer(__FUNCTION__)
|
||||
|
||||
class CallTracer
|
||||
{
|
||||
std::string functionName;
|
||||
public:
|
||||
CallTracer(const char* functionName);
|
||||
~CallTracer();
|
||||
};
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <common/display/dpi_aware.h>
|
||||
#include <common/interop/shared_constants.h>
|
||||
#include <common/logger/logger.h>
|
||||
#include <common/logger/call_tracer.h>
|
||||
#include <common/utils/EventWaiter.h>
|
||||
#include <common/utils/resources.h>
|
||||
#include <common/utils/winapi_error.h>
|
||||
@@ -25,7 +26,6 @@
|
||||
#include "VirtualDesktop.h"
|
||||
#include "MonitorWorkAreaHandler.h"
|
||||
#include "util.h"
|
||||
#include "CallTracer.h"
|
||||
|
||||
#include <FancyZonesLib/SecondaryMouseButtonsHook.h>
|
||||
#include <winrt/Windows.UI.ViewManagement.h>
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#include "JsonHelpers.h"
|
||||
#include "ZoneSet.h"
|
||||
#include "Settings.h"
|
||||
#include "CallTracer.h"
|
||||
#include "GuidUtils.h"
|
||||
|
||||
#include <common/Display/dpi_aware.h>
|
||||
#include <common/logger/call_tracer.h>
|
||||
#include <common/utils/json.h>
|
||||
#include <FancyZonesLib/util.h>
|
||||
#include <FancyZonesLib/FancyZonesWindowProperties.h>
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="CallTracer.h" />
|
||||
<ClInclude Include="FancyZones.h" />
|
||||
<ClInclude Include="FancyZonesDataTypes.h" />
|
||||
<ClInclude Include="FancyZonesWinHookEventIDs.h" />
|
||||
@@ -65,7 +64,6 @@
|
||||
<ClInclude Include="ZoneWindowDrawing.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CallTracer.cpp" />
|
||||
<ClCompile Include="FancyZones.cpp" />
|
||||
<ClCompile Include="FancyZonesDataTypes.cpp" />
|
||||
<ClCompile Include="FancyZonesWinHookEventIDs.cpp" />
|
||||
|
||||
@@ -78,9 +78,6 @@
|
||||
<ClInclude Include="ZoneWindowDrawing.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CallTracer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MonitorUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -149,9 +146,6 @@
|
||||
<ClCompile Include="OnThreadExecutor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CallTracer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MonitorUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include <common/logger/call_tracer.h>
|
||||
|
||||
#include "on_thread_executor.h"
|
||||
#include "CallTracer.h"
|
||||
|
||||
OnThreadExecutor::OnThreadExecutor() :
|
||||
_shutdown_request{ false }, _worker_thread{ [this] { worker_thread(); } }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "WorkArea.h"
|
||||
|
||||
#include <common/logger/call_tracer.h>
|
||||
#include <common/logger/logger.h>
|
||||
|
||||
#include "FancyZonesData.h"
|
||||
@@ -10,7 +11,6 @@
|
||||
#include "util.h"
|
||||
#include "on_thread_executor.h"
|
||||
#include "Settings.h"
|
||||
#include "CallTracer.h"
|
||||
|
||||
#include <ShellScalingApi.h>
|
||||
#include <mutex>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "pch.h"
|
||||
#include "ZoneWindowDrawing.h"
|
||||
#include "CallTracer.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <common/logger/call_tracer.h>
|
||||
#include <common/logger/logger.h>
|
||||
|
||||
namespace
|
||||
|
||||
Reference in New Issue
Block a user