added logs to fancy zones (#8190)

This commit is contained in:
Mykhailo Pylyp
2020-11-25 11:54:10 +02:00
committed by GitHub
parent 095b76b3e8
commit eb264537f3
6 changed files with 54 additions and 0 deletions

View File

@@ -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')" />

View 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;
}

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