Skip to content

Commit 92e59fb

Browse files
committed
fixed reversion 2
1 parent 9f72ac9 commit 92e59fb

1 file changed

Lines changed: 25 additions & 41 deletions

File tree

src/vmaware.hpp

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,51 +1617,35 @@ struct VM {
16171617

16181618
template <typename... Args>
16191619
static inline void debug_msg(Args&&... message) noexcept {
1620-
try {
1621-
std::stringstream ss;
1622-
1623-
ss.setf(std::ios::fixed, std::ios::floatfield);
1624-
ss.precision(2);
1625-
1626-
#if VMA_CPP >= 17
1627-
((ss << std::forward<Args>(message)), ...);
1628-
#else
1629-
using expander = int[];
1630-
(void)expander {
1631-
0, (void(ss << std::forward<Args>(message)), 0)...
1632-
};
1633-
#endif
1634-
1635-
std::string msg_content = ss.str();
1636-
1637-
static std::unordered_set<std::string> printed_messages;
1620+
static std::unordered_set<std::string> printed_messages;
16381621

1639-
if (printed_messages.find(msg_content) == printed_messages.end()) {
1640-
printed_messages.insert(msg_content);
1641-
1642-
// --- Console Output (ANSI Colors for Linux/Mac) ---
1643-
#if (LINUX || APPLE)
1644-
constexpr const char* BLUE_BG = "\x1B[44m";
1645-
constexpr const char* WHITE_FG = "\x1B[97m";
1646-
constexpr const char* BOLD = "\033[1m";
1647-
constexpr const char* RESET = "\033[0m";
1622+
std::stringstream ss;
1623+
print_to_stream(ss, std::forward<Args>(message)...);
1624+
std::string msg_content = ss.str();
16481625

1649-
std::cout << BOLD << BLUE_BG << WHITE_FG << "[DEBUG]" << RESET << " "
1650-
<< msg_content << "\n";
1651-
#else
1652-
// Windows Console (Standard plain text)
1653-
std::cout << "[DEBUG] " << msg_content << "\n";
1654-
#endif
1626+
if (printed_messages.find(msg_content) == printed_messages.end()) {
1627+
#if (LINUX || APPLE)
1628+
constexpr const char* black_bg = "\x1B[48;2;0;0;0m";
1629+
constexpr const char* bold = "\033[1m";
1630+
constexpr const char* blue = "\x1B[38;2;00;59;193m";
1631+
constexpr const char* ansiexit = "\x1B[0m";
1632+
1633+
std::cout.setf(std::ios::fixed, std::ios::floatfield);
1634+
std::cout.setf(std::ios::showpoint);
1635+
1636+
std::cout << black_bg
1637+
<< bold << "["
1638+
<< blue << "DEBUG"
1639+
<< ansiexit << bold << black_bg << "]"
1640+
<< ansiexit << " ";
1641+
#else
1642+
std::cout << "[DEBUG] ";
1643+
#endif
1644+
std::cout << msg_content;
1645+
std::cout << std::dec << "\n";
16551646

1656-
// --- Windows Debug Output (VS Output Window / DebugView) ---
1657-
#if (WINDOWS)
1658-
// OutputDebugStringA does not support ANSI, so we send a clean string
1659-
std::string win_debug_str = "[DEBUG] " + msg_content + "\n";
1660-
OutputDebugStringA(win_debug_str.c_str());
1661-
#endif
1662-
}
1647+
printed_messages.insert(std::move(msg_content));
16631648
}
1664-
catch (...) {}
16651649
}
16661650

16671651

0 commit comments

Comments
 (0)