MCPcopy Create free account
hub / github.com/Vector35/debugger / print

Function print

cli/log.h:68–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67 template <Mode LogMode = Mode::None, typename... Args>
68 bool print(const std::string_view str, Args... args)
69 {
70 if constexpr (LogMode == Mode::Debug)
71 fmt::print("[{}DEBUG\033[0m] {}", Style(173, 216, 230), Style(173, 216, 230));
72
73 if constexpr (LogMode == Mode::Info)
74 fmt::print("[{}INFO\033[0m] {}", Style(144, 238, 144), Style(144, 238, 144));
75
76 if constexpr (LogMode == Mode::Warning)
77 fmt::print("[{}WARNING\033[0m] {}", Style(255, 255, 224), Style(255, 255, 224));
78
79 if constexpr (LogMode == Mode::Error)
80 fmt::print("[{}ERROR\033[0m] {}", Style(255, 114, 118), Style(255, 114, 118));
81
82 if constexpr (LogMode == Mode::Alert)
83 fmt::print("[{}ALERT\033[0m] {}", Style(255, 0, 0), Style(255, 0, 0));
84
85 fmt::print(str.data(), std::forward<Args>(args)...);
86 fmt::print("\033[0m");
87
88 if constexpr (LogMode != Mode::None)
89 {
90 const auto binja_string =
91 fmt::format("[BINARYNINJA] {}", fmt::format(str.data(), std::forward<Args>(args)...));
92 BinaryNinja::Log(static_cast<BNLogLevel>(LogMode), "%s", binja_string.c_str());
93 }
94
95 return true;
96 }
97} // namespace Log
98
99/* overloading Log::Style for fmtlib so that we don't need to call .AsAnsi() when formatting */

Callers 5

RegisterDisplayFunction · 0.85
DisasmDisplayFunction · 0.85
mainFunction · 0.85
test_attachMethod · 0.85
build.pyFile · 0.85

Calls 2

StyleClass · 0.85
dataMethod · 0.45

Tested by 1

test_attachMethod · 0.68