Fix runner warnings (#8211)

This commit is contained in:
Mykhailo Pylyp
2020-11-30 16:16:49 +02:00
committed by GitHub
parent 7c9888300b
commit f0553c370a
17 changed files with 101 additions and 139 deletions

View File

@@ -1,24 +0,0 @@
#include "pch.h"
#include "ShortcutGuideLogger.h"
#include <common\settings_helpers.h>
#include <filesystem>
std::shared_ptr<Logger> ShortcutGuideLogger::logger;
void ShortcutGuideLogger::Init(std::wstring moduleSaveLocation)
{
std::filesystem::path logFilePath(moduleSaveLocation);
logFilePath.append(LogSettings::shortcutGuideLogPath);
logger = std::make_shared<Logger>(LogSettings::shortcutGuideLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
logger->info("Shortcut Guide logger initialized");
}
std::shared_ptr<Logger> ShortcutGuideLogger::GetLogger()
{
if (!logger)
{
throw "Shortcut Guide logger is not initialized";
}
return logger;
}

View File

@@ -1,11 +0,0 @@
#pragma once
#include <common/logger/logger.h>
class ShortcutGuideLogger
{
static std::shared_ptr<Logger> logger;
public:
static void Init(std::wstring moduleSaveLocation);
static std::shared_ptr<Logger> GetLogger();
};

View File

@@ -7,9 +7,11 @@
#include <common/settings_objects.h>
#include <common/debug_control.h>
#include <sstream>
#include <modules\shortcut_guide\ShortcutGuideConstants.h>
#include <modules\shortcut_guide\ShortcutGuideLogger.h>
#include <common\settings_helpers.cpp>
#include <modules/shortcut_guide/ShortcutGuideConstants.h>
#include <common/settings_helpers.cpp>
#include <common/logger/logger.h>
extern "C" IMAGE_DOS_HEADER __ImageBase;
@@ -98,8 +100,10 @@ OverlayWindow::OverlayWindow()
{
app_name = GET_RESOURCE_STRING(IDS_SHORTCUT_GUIDE);
app_key = ShortcutGuideConstants::ModuleKey;
ShortcutGuideLogger::Init(PTSettingsHelper::get_module_save_folder_location(app_key));
ShortcutGuideLogger::GetLogger()->info("Overlay Window is creating");
std::filesystem::path logFilePath(PTSettingsHelper::get_module_save_folder_location(app_key));
logFilePath.append(LogSettings::shortcutGuideLogPath);
Logger::init(LogSettings::shortcutGuideLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
Logger::info("Overlay Window is creating");
init_settings();
}
@@ -200,7 +204,7 @@ constexpr UINT alternative_switch_vk_code = VK_OEM_2;
void OverlayWindow::enable()
{
ShortcutGuideLogger::GetLogger()->info("Shortcut Guide is enabling");
Logger::info("Shortcut Guide is enabling");
auto switcher = [&](HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) -> LRESULT {
if (msg == WM_KEYDOWN && wparam == VK_ESCAPE && instance->target_state->active())
@@ -253,7 +257,7 @@ void OverlayWindow::enable()
void OverlayWindow::disable(bool trace_event)
{
ShortcutGuideLogger::GetLogger()->info("Shortcut Guide is disabling");
Logger::info("Shortcut Guide is disabling");
if (_enabled)
{

View File

@@ -112,7 +112,6 @@
<ClInclude Include="Generated Files/resource.h" />
<None Include="resource.base.h" />
<ClInclude Include="ShortcutGuideConstants.h" />
<ClInclude Include="ShortcutGuideLogger.h" />
<ClInclude Include="shortcut_guide.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="target_state.h" />
@@ -125,7 +124,6 @@
<ClCompile Include="overlay_window.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="keyboard_state.cpp" />
<ClCompile Include="ShortcutGuideLogger.cpp" />
<ClCompile Include="shortcut_guide.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>