Browse Source
[common/log] reoder file:func:line to file:line:func for nicer IDE integration with logs (#3321)
Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3321
Reviewed-by: DraVee <dravee@eden-emu.dev>
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
pull/3338/head
lizzie
2 weeks ago
committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
1 changed files with
2 additions and
1 deletions
-
src/common/logging/text_formatter.cpp
|
|
@ -23,13 +23,14 @@ |
|
|
|
|
|
|
|
|
namespace Common::Log { |
|
|
namespace Common::Log { |
|
|
|
|
|
|
|
|
|
|
|
// Some IDEs prefer <file>:<line> instead, so let's just do that :)
|
|
|
std::string FormatLogMessage(const Entry& entry) { |
|
|
std::string FormatLogMessage(const Entry& entry) { |
|
|
auto const time_seconds = uint32_t(entry.timestamp.count() / 1000000); |
|
|
auto const time_seconds = uint32_t(entry.timestamp.count() / 1000000); |
|
|
auto const time_fractional = uint32_t(entry.timestamp.count() % 1000000); |
|
|
auto const time_fractional = uint32_t(entry.timestamp.count() % 1000000); |
|
|
char const* class_name = GetLogClassName(entry.log_class); |
|
|
char const* class_name = GetLogClassName(entry.log_class); |
|
|
char const* level_name = GetLevelName(entry.log_level); |
|
|
char const* level_name = GetLevelName(entry.log_level); |
|
|
return fmt::format("[{:4d}.{:06d}] {} <{}> {}:{}:{}: {}", time_seconds, time_fractional, |
|
|
return fmt::format("[{:4d}.{:06d}] {} <{}> {}:{}:{}: {}", time_seconds, time_fractional, |
|
|
class_name, level_name, entry.filename, entry.function, entry.line_num, |
|
|
|
|
|
|
|
|
class_name, level_name, entry.filename, entry.line_num, entry.function, |
|
|
entry.message); |
|
|
entry.message); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|