Created
November 27, 2025 07:08
-
-
Save WiwilZ/cfff4cd0fdf39b7cb6fc49a227c079dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace Logger { | |
| struct FormatWithLocation { | |
| std::string_view str; | |
| std::source_location loc; | |
| template <typename String> | |
| FormatWithLocation(const String& str, const std::source_location& loc = std::source_location::current()): str(str), loc(loc) {} | |
| template <typename...Args> | |
| void Debug(FormatWithLocation fmt, Args &&...args) { | |
| std::string formattedMessage = std::vformat(fmt.value, std::make_format_args(std::forward<Args>(args)...)); | |
| std::cout << std::format("[{}:{}] {}\n", fmt.loc.file_name(), fmt.loc.line(), formattedMessage); | |
| } | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment