Skip to content

Commit

Permalink
ci: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 13, 2023
1 parent 2596cdd commit 404e688
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 95 deletions.
16 changes: 8 additions & 8 deletions src/Hooks.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "Hooks.h"

namespace Hooks
{
void Install() noexcept
{
}
} // namespace Hooks
#include "Hooks.h"

namespace Hooks
{
void Install() noexcept
{
}
} // namespace Hooks
46 changes: 23 additions & 23 deletions src/Logging.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#include "Logging.h"

void InitializeLogging() noexcept
{
auto path{ SFSE::log::log_directory() };
if (!path)
stl::report_and_fail("Unable to lookup SFSE logs directory.");
*path /= Plugin::Name;
*path += L".log";

std::shared_ptr<spdlog::logger> log;
if (IsDebuggerPresent())
log = std::make_shared<spdlog::logger>("Global", std::make_shared<spdlog::sinks::msvc_sink_mt>());
else
log = std::make_shared<spdlog::logger>("Global", std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true));

log->set_level(spdlog::level::level_enum::info);
log->flush_on(spdlog::level::level_enum::trace);

set_default_logger(std::move(log));

spdlog::set_pattern("[%T.%e UTC%z] [%L] [%=5t] %v");
}
#include "Logging.h"

void InitializeLogging() noexcept
{
auto path{ SFSE::log::log_directory() };
if (!path)
stl::report_and_fail("Unable to lookup SFSE logs directory.");
*path /= Plugin::Name;
*path += L".log";

std::shared_ptr<spdlog::logger> log;
if (IsDebuggerPresent())
log = std::make_shared<spdlog::logger>("Global", std::make_shared<spdlog::sinks::msvc_sink_mt>());
else
log = std::make_shared<spdlog::logger>("Global", std::make_shared<spdlog::sinks::basic_file_sink_mt>(path->string(), true));

log->set_level(spdlog::level::level_enum::info);
log->flush_on(spdlog::level::level_enum::trace);

set_default_logger(std::move(log));

spdlog::set_pattern("[%T.%e UTC%z] [%L] [%=5t] %v");
}
82 changes: 41 additions & 41 deletions src/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
#include "Hooks.h"
#include "Logging.h"
#include "Settings.h"

void Listener(SFSE::MessagingInterface::Message* message) noexcept
{
if (message->type <=> SFSE::MessagingInterface::kPostPostLoad == 0)
{
Settings::LoadSettings();
Hooks::Install();
}
}

SFSEPluginLoad(const SFSE::LoadInterface* sfse)
{
InitializeLogging();

logger::info("{} {} is loading...", Plugin::Name, Plugin::Version);

Init(sfse);

if (const auto messaging{ SFSE::GetMessagingInterface() }; !messaging->RegisterListener(Listener))
return false;

logger::info("{} has finished loading.", Plugin::Name);

return true;
}

SFSEPluginVersion = []() noexcept {
SFSE::PluginVersionData data{};

data.PluginVersion(Plugin::Version);
data.PluginName(Plugin::Name);
data.AuthorName(Plugin::Author);
data.UsesSigScanning(false);
data.HasNoStructUse(true);
data.CompatibleVersions({ SFSE::RUNTIME_LATEST });

return data;
}();
#include "Hooks.h"
#include "Logging.h"
#include "Settings.h"

void Listener(SFSE::MessagingInterface::Message* message) noexcept
{
if (message->type <=> SFSE::MessagingInterface::kPostPostLoad == 0)
{
Settings::LoadSettings();
Hooks::Install();
}
}

SFSEPluginLoad(const SFSE::LoadInterface* sfse)
{
InitializeLogging();

logger::info("{} {} is loading...", Plugin::Name, Plugin::Version);

Init(sfse);

if (const auto messaging{ SFSE::GetMessagingInterface() }; !messaging->RegisterListener(Listener))
return false;

logger::info("{} has finished loading.", Plugin::Name);

return true;
}

SFSEPluginVersion = []() noexcept {
SFSE::PluginVersionData data{};

data.PluginVersion(Plugin::Version);
data.PluginName(Plugin::Name);
data.AuthorName(Plugin::Author);
data.UsesSigScanning(false);
data.HasNoStructUse(true);
data.CompatibleVersions({ SFSE::RUNTIME_LATEST });

return data;
}();
46 changes: 23 additions & 23 deletions src/Settings.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#include "Settings.h"

void Settings::LoadSettings() noexcept
{
logger::info("Loading settings");

CSimpleIniA ini;

ini.SetUnicode();
ini.LoadFile(R"(.\Data\SFSE\Plugins\PluginName.ini)");

debug_logging = ini.GetBoolValue("Log", "Debug");

if (debug_logging)
{
spdlog::get("Global")->set_level(spdlog::level::level_enum::debug);
logger::debug("Debug logging enabled");
}

// Load settings

logger::info("Loaded settings");
}
#include "Settings.h"

void Settings::LoadSettings() noexcept
{
logger::info("Loading settings");

CSimpleIniA ini;

ini.SetUnicode();
ini.LoadFile(R"(.\Data\SFSE\Plugins\PluginName.ini)");

debug_logging = ini.GetBoolValue("Log", "Debug");

if (debug_logging)
{
spdlog::get("Global")->set_level(spdlog::level::level_enum::debug);
logger::debug("Debug logging enabled");
}

// Load settings

logger::info("Loaded settings");
}

0 comments on commit 404e688

Please sign in to comment.