From 4fbd6010b311b20d42cc09fc19960e18345487ec Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 31 Oct 2026 16:22:45 +0100 Subject: [PATCH] Add a log messages achievement. --- profiler/CMakeLists.txt | 1 + profiler/src/achievements/LogMessages.md | 7 +++++++ profiler/src/profiler/TracyAchievementData.cpp | 8 ++++++++ profiler/src/profiler/TracyView_Messages.cpp | 2 ++ 4 files changed, 18 insertions(+) create mode 100644 profiler/src/achievements/LogMessages.md diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index dfd18230..748857ad 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -226,6 +226,7 @@ Embed(PROFILER_FILES TextIntro src/achievements/Intro.md TEXT) Embed(PROFILER_FILES TextLeaks src/achievements/Leaks.md TEXT) Embed(PROFILER_FILES TextLoadTrace src/achievements/LoadTrace.md TEXT) Embed(PROFILER_FILES TextLocks src/achievements/Locks.md TEXT) +Embed(PROFILER_FILES TextLogMessages src/achievements/LogMessages.md TEXT) Embed(PROFILER_FILES TextManual src/achievements/Manual.md TEXT) Embed(PROFILER_FILES TextMemory src/achievements/Memory.md TEXT) Embed(PROFILER_FILES TextMemoryPools src/achievements/MemoryPools.md TEXT) diff --git a/profiler/src/achievements/LogMessages.md b/profiler/src/achievements/LogMessages.md new file mode 100644 index 00000000..8734adbe --- /dev/null +++ b/profiler/src/achievements/LogMessages.md @@ -0,0 +1,7 @@ +# Log messages + +Your debug output is worth keeping in the [trace log](#messagelog), not just on the console. `TracyMessageL( "config loaded" )` takes a string literal, `TracyMessage` takes a pointer and a size, and the `C` variants add a color so an entry stays findable in a long log. + +All four always log with `Info` severity. `Warning` and `Error` are only reachable through `TracyLogString( severity, color, depth, txt )`, the underlying log call they all share. Most programs wrap it in their own small macros. Message macros with the `S` postfix capture a call stack as well. + +The * Messages* button on the top bar opens the [Messages window](#messages). Every message gets a row with its time, thread, text and stack. Hovering a row highlights it on the timeline, clicking centers the view. Log something and look at the list! diff --git a/profiler/src/profiler/TracyAchievementData.cpp b/profiler/src/profiler/TracyAchievementData.cpp index d7cce019..136be437 100644 --- a/profiler/src/profiler/TracyAchievementData.cpp +++ b/profiler/src/profiler/TracyAchievementData.cpp @@ -24,6 +24,7 @@ #include "data/TextLightFlame.hpp" #include "data/TextLoadTrace.hpp" #include "data/TextLocks.hpp" +#include "data/TextLogMessages.hpp" #include "data/TextManual.hpp" #include "data/TextMemory.hpp" #include "data/TextMemoryPools.hpp" @@ -221,12 +222,19 @@ AchievementItem ai_chartValues = { .text = Unpack( TextPlots ) }; +AchievementItem ai_logMessages = { + .id = "logMessages", + .name = "Log messages", + .text = Unpack( TextLogMessages ) +}; + AchievementItem* ac_instrumentationIntroItems[] = { &ai_100million, &ai_instrumentationStatistics, &ai_annotateZones, &ai_markSections, &ai_chartValues, + &ai_logMessages, nullptr }; diff --git a/profiler/src/profiler/TracyView_Messages.cpp b/profiler/src/profiler/TracyView_Messages.cpp index 351feb90..e8bf6bb2 100644 --- a/profiler/src/profiler/TracyView_Messages.cpp +++ b/profiler/src/profiler/TracyView_Messages.cpp @@ -29,6 +29,8 @@ void View::DrawMessages() return; } + if( s_config.achievements ) Achieve( "logMessages" ); + ImGui::AlignTextToFramePadding(); ImGui::Text( ICON_FA_FILTER ); ImGui::SameLine();