Skip to content

Commit

Permalink
fix errors in MSC compile
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Oct 7, 2024
1 parent f0e9439 commit 230103d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
18 changes: 14 additions & 4 deletions include/firestarter/Logging/Log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,20 @@ class StdOut {
}
};

using Record = nitro::log::record<nitro::log::severity_attribute, nitro::log::message_attribute,
// NOLINTBEGIN(readability-identifier-naming)
// The class may not be named Record since this is used as a template argument name in nitro which will cause errors
// when compiling with MSC.
using record = nitro::log::record<nitro::log::severity_attribute, nitro::log::message_attribute,
nitro::log::timestamp_attribute, nitro::log::std_thread_id_attribute>;
// NOLINTEND(readability-identifier-naming)

template <typename Record> class Formater {
template <typename Record>
// NOLINTBEGIN(readability-identifier-naming)
// The class may not be named Formater since this is used as a template argument name in nitro which will cause errors
// when compiling with MSC. We will also write it with lower case and the correct spelling in case it gets renamed
// correctly there.
class formatter {
// NOLINTEND(readability-identifier-naming)
public:
auto format(Record& R) -> std::string {
std::stringstream S;
Expand Down Expand Up @@ -92,9 +102,9 @@ using WorkerFilter = nitro::log::filter::and_filter<Filter<Record>, FirstWorkerT

} // namespace logging

using log = nitro::log::logger<logging::Record, logging::Formater, firestarter::logging::StdOut, logging::Filter>;
using log = nitro::log::logger<logging::record, logging::formatter, firestarter::logging::StdOut, logging::Filter>;

using workerLog =
nitro::log::logger<logging::Record, logging::Formater, firestarter::logging::StdOut, logging::WorkerFilter>;
nitro::log::logger<logging::record, logging::formatter, firestarter::logging::StdOut, logging::WorkerFilter>;

} // namespace firestarter
8 changes: 4 additions & 4 deletions src/firestarter/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ Config::Config(int Argc, const char** Argv) {
auto Options = Parser.parse(Argc, Argv);

if (static_cast<bool>(Options.count("quiet"))) {
firestarter::logging::Filter<firestarter::logging::Record>::set_severity(nitro::log::severity_level::warn);
firestarter::logging::Filter<firestarter::logging::record>::set_severity(nitro::log::severity_level::warn);
} else if (static_cast<bool>(Options.count("report"))) {
firestarter::logging::Filter<firestarter::logging::Record>::set_severity(nitro::log::severity_level::debug);
firestarter::logging::Filter<firestarter::logging::record>::set_severity(nitro::log::severity_level::debug);
} else if (static_cast<bool>(Options.count("debug"))) {
firestarter::logging::Filter<firestarter::logging::Record>::set_severity(nitro::log::severity_level::trace);
firestarter::logging::Filter<firestarter::logging::record>::set_severity(nitro::log::severity_level::trace);
} else {
firestarter::logging::Filter<firestarter::logging::Record>::set_severity(nitro::log::severity_level::info);
firestarter::logging::Filter<firestarter::logging::record>::set_severity(nitro::log::severity_level::info);
}

if (static_cast<bool>(Options.count("version"))) {
Expand Down

0 comments on commit 230103d

Please sign in to comment.