Skip to content

Commit a9e583f

Browse files
committed
feat: prefix warn and err message with labels
1 parent 6c18020 commit a9e583f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

vendor/lief/src/logging.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,19 @@ class Logger {
9191

9292
template <typename... Args>
9393
static void err(const char *fmt, const Args &... args) {
94+
const char *prefix = "Error: ";
95+
const std::string prefixed_fmt = std::string(prefix) + std::string(fmt);
9496
if /* constexpr */ (lief_logging_support) {
95-
Logger::instance().sink_->error(fmt, args...);
97+
Logger::instance().sink_->error(prefixed_fmt.c_str(), args...);
9698
}
9799
}
98100

99101
template <typename... Args>
100102
static void warn(const char *fmt, const Args &... args) {
103+
const char *prefix = "Warning: ";
104+
const std::string prefixed_fmt = std::string(prefix) + std::string(fmt);
101105
if /* constexpr */ (lief_logging_support) {
102-
Logger::instance().sink_->warn(fmt, args...);
106+
Logger::instance().sink_->warn(prefixed_fmt, args...);
103107
}
104108
}
105109

0 commit comments

Comments
 (0)