diff options
author | hop311 <hop3114@gmail.com> | 2023-10-29 23:16:14 +0100 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-11-07 19:32:43 +0100 |
commit | 8a00697a0e6a4168894594eadc373836a1689eea (patch) | |
tree | a8af4d6c77764644305be324b32b96b9c272e563 /src/openvic-simulation/utility/Logger.hpp | |
parent | 61e5c971cd371950a3bd659799208d8143dddd4f (diff) |
Country: datatypes + TGC compat changes
Diffstat (limited to 'src/openvic-simulation/utility/Logger.hpp')
-rw-r--r-- | src/openvic-simulation/utility/Logger.hpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/openvic-simulation/utility/Logger.hpp b/src/openvic-simulation/utility/Logger.hpp index a1c599d..04306f7 100644 --- a/src/openvic-simulation/utility/Logger.hpp +++ b/src/openvic-simulation/utility/Logger.hpp @@ -65,13 +65,13 @@ namespace OpenVic { struct log { log(log_channel_t& log_channel, Ts&&... ts, source_location const& location) { std::stringstream stream; - stream << "\n" << get_filename(location.file_name()) << "(" + stream << get_filename(location.file_name()) << "(" /* Function name removed to reduce clutter. It is already included * in Godot's print functions, so this was repeating it. */ //<< location.line() << ") `" << location.function_name() << "`: "; << location.line() << "): "; ((stream << std::forward<Ts>(ts)), ...); - stream << std::endl; + stream << "\n" << std::endl; log_channel.queue.push(stream.str()); if (log_channel.func) { do { @@ -83,20 +83,21 @@ namespace OpenVic { }; #define LOG_FUNC(name) \ - private: \ - static inline log_channel_t name##_channel {}; \ - public: \ - static inline void set_##name##_func(log_func_t log_func) { \ - name##_channel.func = log_func; \ +private: \ + static inline log_channel_t name##_channel {}; \ +\ +public: \ + static inline void set_##name##_func(log_func_t log_func) { \ + name##_channel.func = log_func; \ + } \ + template<typename... Ts> \ + struct name { \ + name(Ts&&... ts, source_location const& location = source_location::current()) { \ + log<Ts...> { name##_channel, std::forward<Ts>(ts)..., location }; \ } \ - template<typename... Ts> \ - struct name { \ - name(Ts&&... ts, source_location const& location = source_location::current()) { \ - log<Ts...> { name##_channel, std::forward<Ts>(ts)..., location }; \ - } \ - }; \ - template<typename... Ts> \ - name(Ts&&...) -> name<Ts...>; + }; \ + template<typename... Ts> \ + name(Ts&&...) -> name<Ts...>; LOG_FUNC(info) LOG_FUNC(warning) |