Skip to content

Commit

Permalink
test fmt-10.1.1 and spedlog v1.12.0 - ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Haberler committed Oct 20, 2023
1 parent aeaba7f commit 0893984
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5
framework = arduino

build_flags =
-DFMT_HEADER_ONLY
-DTEST_SPDLOG
; -std=c++20
; -DFMT_HEADER_ONLY
-DBOARD_HAS_PSRAM
-DEMBEDDED ; for fmtlib
-DSPDLOG_COMPILED_LIB ; for spdlog
Expand All @@ -38,5 +40,5 @@ debug_speed = 40000
lib_deps =
https://github.com/mhaberler/M5GFX.git#arduino-3.0
m5stack/M5Unified@^0.1.10
https://github.com/mhaberler/fmtlib#mah-10.0.0
/home/mah/src/spdlog
https://github.com/mhaberler/fmtlib#mah-10.1.1
https://github.com/gabime/spdlog#v1.12.0
6 changes: 4 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#undef B1 // fmt workaround
#undef F
#include <fmt/core.h>
#ifdef TEST_SPDLOG

#include <array>
#include <numeric>
Expand All @@ -11,6 +12,7 @@
#include "spdlog/fmt/bin_to_hex.h"

auto main_log = spdlog::stdout_color_mt("main", spdlog::color_mode::always);
#endif

M5GFX display;

Expand All @@ -36,7 +38,7 @@ void setup(void)
M5.begin(cfg);

std::string s = fmt::format("The answer is {}.", 42);

#ifdef TEST_SPDLOG
spdlog::set_level(spdlog::level::trace); // Set global log level to trace
spdlog::set_pattern("[%t] [%C-%m-%d %H:%M:%S.%e] [%n] [%^%l%$] %v");

Expand All @@ -51,7 +53,7 @@ void setup(void)
std::array<char, 64> a;
std::iota(a.begin(), a.end(), 1);
main_log->critical("{:s:X}", spdlog::to_hex(a));

#endif
display.init();
display.startWrite();
display.fillScreen(TFT_BLACK);
Expand Down

0 comments on commit 0893984

Please sign in to comment.