-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set -DENABLE_LOGGING=OFF to disable the dependency on spdlog
- Loading branch information
1 parent
93880c8
commit faf97b8
Showing
8 changed files
with
40 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,36 @@ | ||
#pragma once | ||
|
||
#include <nautilus/config.hpp> | ||
#ifdef ENABLE_LOGGING | ||
#include <spdlog/spdlog.h> | ||
#endif | ||
|
||
namespace nautilus::log { | ||
template <typename... Args> | ||
void info(spdlog::format_string_t<Args...> fmt, Args&&... args) { | ||
spdlog::info(fmt, std::forward<Args>(args)...); | ||
void info([[maybe_unused]] const char* fmt, [[maybe_unused]]Args&&... args) { | ||
#ifdef ENABLE_LOGGING | ||
spdlog::info("{}", fmt::format(fmt::runtime(fmt), std::forward<Args>(args)...)); | ||
#endif | ||
} | ||
|
||
template <typename... Args> | ||
void debug(spdlog::format_string_t<Args...> fmt, Args&&... args) { | ||
spdlog::debug(fmt, std::forward<Args>(args)...); | ||
void debug([[maybe_unused]] const char* fmt, [[maybe_unused]] Args&&... args) { | ||
#ifdef ENABLE_LOGGING | ||
spdlog::debug("{}", fmt::format(fmt::runtime(fmt), std::forward<Args>(args)...)); | ||
#endif | ||
} | ||
|
||
template <typename... Args> | ||
void trace(spdlog::format_string_t<Args...> fmt, Args&&... args) { | ||
spdlog::trace(fmt, std::forward<Args>(args)...); | ||
void trace([[maybe_unused]] const char* fmt, [[maybe_unused]] Args&&... args) { | ||
#ifdef ENABLE_LOGGING | ||
spdlog::trace("{}",fmt::format(fmt::runtime(fmt), std::forward<Args>(args)...)); | ||
#endif | ||
} | ||
|
||
template <typename... Args> | ||
void error(spdlog::format_string_t<Args...> fmt, Args&&... args) { | ||
spdlog::debug(fmt, std::forward<Args>(args)...); | ||
void error([[maybe_unused]] const char* fmt, [[maybe_unused]] Args&&... args) { | ||
#ifdef ENABLE_LOGGING | ||
spdlog::error("{}", fmt::format(fmt::runtime(fmt), std::forward<Args>(args)...)); | ||
#endif | ||
} | ||
} // namespace nautilus::log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters