diff options
Diffstat (limited to 'src/openvic-simulation/utility/Logger.hpp')
-rw-r--r-- | src/openvic-simulation/utility/Logger.hpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/openvic-simulation/utility/Logger.hpp b/src/openvic-simulation/utility/Logger.hpp index d60e59e..b2395ac 100644 --- a/src/openvic-simulation/utility/Logger.hpp +++ b/src/openvic-simulation/utility/Logger.hpp @@ -20,15 +20,23 @@ namespace OpenVic { int _line; std::string _function; - public: source_location(std::string f, int l, std::string n) : _file(f), _line(l), _function(n) {} - static source_location current(std::string f = __builtin_FILE(), int l = __builtin_LINE(), std::string n = __builtin_FUNCTION()) { + + public: + static source_location current(std::string f = __builtin_FILE(), int l = __builtin_LINE(), + std::string n = __builtin_FUNCTION()) { return source_location(f, l, n); } - inline char const* file_name() const { return _file.c_str(); } - inline int line() const { return _line; } - inline char const* function_name() const { return _function.c_str(); } + inline char const* file_name() const { + return _file.c_str(); + } + inline int line() const { + return _line; + } + inline char const* function_name() const { + return _function.c_str(); + } }; #endif @@ -57,8 +65,10 @@ namespace OpenVic { log(log_channel_t& log_channel, Ts&&... ts, source_location const& location) { std::stringstream stream; stream << "\n" << get_filename(location.file_name()) << "(" - //<< location.line() << ") `" << location.function_name() << "`: "; - << location.line() << "): "; + /* 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; log_channel.queue.push(stream.str()); |