Skip to content

Commit

Permalink
Bump Vcpkg baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-johansson committed Nov 24, 2023
1 parent d869f85 commit e4c85da
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
20 changes: 13 additions & 7 deletions modules/core/inc/tactile/core/debug/log/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#include "tactile/core/prelude.hpp"
#include "tactile/core/type/chrono.hpp"

#define TACTILE_LOG(Level, FmtString, ...) \
do { \
auto* tactile_logger = tactile::get_default_logger(); \
if (tactile_logger && tactile_logger->would_log((Level))) { \
tactile_logger->log((Level), (FmtString), fmt::make_format_args(__VA_ARGS__)); \
} \
#define TACTILE_LOG(Level, FmtString, ...) \
do { \
auto* tactile_logger = tactile::get_default_logger(); \
if (tactile_logger && tactile_logger->would_log((Level))) { \
tactile_logger->log((Level), (FmtString) __VA_OPT__(, ) __VA_ARGS__); \
} \
} while (false)

#define TACTILE_LOG_TRACE(FmtString, ...) \
Expand Down Expand Up @@ -59,7 +59,11 @@ class TACTILE_CORE_API Logger final {
* \param fmt_string the format string.
* \param args the format arguments.
*/
void log(LogLevel level, StringView fmt_string, fmt::format_args args) noexcept;
template <typename... Args>
void log(const LogLevel level, const StringView fmt_string, Args&&... args) noexcept
{
_log(level, fmt_string, fmt::make_format_args(args...));
}

/**
* \brief Sets the minimum severity of messages that get logged.
Expand Down Expand Up @@ -125,6 +129,8 @@ class TACTILE_CORE_API Logger final {
Vector<Managed<ILoggerSink>> mSinks;
Maybe<SteadyClockInstant> mReferenceInstant;

void _log(LogLevel level, StringView fmt_string, fmt::format_args args) noexcept;

[[nodiscard]]
auto _to_elapsed_time(SteadyClockInstant instant) const -> Microseconds;
};
Expand Down
29 changes: 9 additions & 20 deletions modules/core/src/tactile/core/debug/log/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ constinit Logger* gDefaultLogger = nullptr;

} // namespace

void Logger::log(const LogLevel level,
const StringView fmt_string,
const fmt::format_args args) noexcept
void Logger::_log(const LogLevel level,
const StringView fmt_string,
const fmt::format_args args) noexcept
{
try {
if (!mSinks.empty() && would_log(level)) {
Expand Down Expand Up @@ -96,23 +96,12 @@ auto Logger::would_flush(const LogLevel level) const noexcept -> bool
auto Logger::get_acronym(const LogLevel level) noexcept -> StringView
{
switch (level) {
case LogLevel::kTrace:
return "TRC";

case LogLevel::kDebug:
return "DBG";

case LogLevel::kInfo:
return "INF";

case LogLevel::kWarn:
return "WRN";

case LogLevel::kError:
return "ERR";

case LogLevel::kFatal:
return "FTL";
case LogLevel::kTrace: return "TRC";
case LogLevel::kDebug: return "DBG";
case LogLevel::kInfo: return "INF";
case LogLevel::kWarn: return "WRN";
case LogLevel::kError: return "ERR";
case LogLevel::kFatal: return "FTL";
}

return "";
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"maintainers": [
"albin-johansson"
],
"builtin-baseline": "a54b77790d1632394bc16621ef83613dd4480320",
"builtin-baseline": "cd5e746ec203c8c3c61647e0886a8df8c1e78e41",
"dependencies": [
"argparse",
"boost-stacktrace",
Expand Down

0 comments on commit e4c85da

Please sign in to comment.