mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
added logs to fancy zones (#8190)
This commit is contained in:
@@ -103,6 +103,7 @@
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FancyZonesLogger.h" />
|
||||
<ClInclude Include="FancyZones.h" />
|
||||
<ClInclude Include="FancyZonesDataTypes.h" />
|
||||
<ClInclude Include="FancyZonesWinHookEventIDs.h" />
|
||||
@@ -128,6 +129,7 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FancyZones.cpp" />
|
||||
<ClCompile Include="FancyZonesDataTypes.cpp" />
|
||||
<ClCompile Include="FancyZonesLogger.cpp" />
|
||||
<ClCompile Include="FancyZonesWinHookEventIDs.cpp" />
|
||||
<ClCompile Include="FancyZonesData.cpp" />
|
||||
<ClCompile Include="JsonHelpers.cpp" />
|
||||
@@ -156,7 +158,13 @@
|
||||
<ItemGroup>
|
||||
<None Include="Resources.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
|
||||
</ProjectReference>
|
||||
</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')" />
|
||||
|
||||
24
src/modules/fancyzones/lib/FancyZonesLogger.cpp
Normal file
24
src/modules/fancyzones/lib/FancyZonesLogger.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "pch.h"
|
||||
#include <common\settings_helpers.h>
|
||||
#include <filesystem>
|
||||
#include "FancyZonesLogger.h"
|
||||
|
||||
std::shared_ptr<Logger> FancyZonesLogger::logger;
|
||||
|
||||
void FancyZonesLogger::Init(std::wstring moduleSaveLocation)
|
||||
{
|
||||
std::filesystem::path logFilePath(moduleSaveLocation);
|
||||
logFilePath.append(LogSettings::fancyZonesLogPath);
|
||||
logger = std::make_shared<Logger>(LogSettings::fancyZonesLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
|
||||
logger->info("FancyZones logger initialized");
|
||||
}
|
||||
|
||||
std::shared_ptr<Logger> FancyZonesLogger::GetLogger()
|
||||
{
|
||||
if (!logger)
|
||||
{
|
||||
throw "FancyZones logger is not initialized";
|
||||
}
|
||||
|
||||
return logger;
|
||||
}
|
||||
10
src/modules/fancyzones/lib/FancyZonesLogger.h
Normal file
10
src/modules/fancyzones/lib/FancyZonesLogger.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include <common/logger/logger.h>
|
||||
|
||||
class FancyZonesLogger
|
||||
{
|
||||
static std::shared_ptr<Logger> logger;
|
||||
public:
|
||||
static void Init(std::wstring moduleSaveLocation);
|
||||
static std::shared_ptr<Logger> GetLogger();
|
||||
};
|
||||
Reference in New Issue
Block a user