summaryrefslogtreecommitdiff
path: root/log.cpp
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2023-11-07 18:55:32 -0500
committerGlenn Smith <glenn@vector35.com>2023-11-13 17:22:16 -0500
commit1716451033063812056349156332128984540962 (patch)
tree7a12ab7cdb9c15ffadfaa42651e7fe044ff7befa /log.cpp
parent0cc0b1ce9f7e1bcf4b8fac581ab4e5a354906ba4 (diff)
Add fmt library to api
Diffstat (limited to 'log.cpp')
-rw-r--r--log.cpp98
1 files changed, 98 insertions, 0 deletions
diff --git a/log.cpp b/log.cpp
index f8318cc3..e35b3663 100644
--- a/log.cpp
+++ b/log.cpp
@@ -162,6 +162,55 @@ void BinaryNinja::LogAlert(const char* fmt, ...)
}
+void BinaryNinja::LogFV(BNLogLevel level, fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ Log(level, "%s", value.c_str());
+}
+
+
+void BinaryNinja::LogTraceFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogTrace("%s", value.c_str());
+}
+
+
+void BinaryNinja::LogDebugFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogDebug("%s", value.c_str());
+}
+
+
+void BinaryNinja::LogInfoFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogInfo("%s", value.c_str());
+}
+
+
+void BinaryNinja::LogWarnFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogWarn("%s", value.c_str());
+}
+
+
+void BinaryNinja::LogErrorFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogError("%s", value.c_str());
+}
+
+
+void BinaryNinja::LogAlertFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogAlert("%s", value.c_str());
+}
+
+
void BinaryNinja::LogToStdout(BNLogLevel minimumLevel)
{
BNLogToStdout(minimumLevel);
@@ -267,6 +316,55 @@ void Logger::LogAlert(const char* fmt, ...)
}
+void Logger::LogFV(BNLogLevel level, fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ Log(level, "%s", value.c_str());
+}
+
+
+void Logger::LogTraceFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogTrace("%s", value.c_str());
+}
+
+
+void Logger::LogDebugFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogDebug("%s", value.c_str());
+}
+
+
+void Logger::LogInfoFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogInfo("%s", value.c_str());
+}
+
+
+void Logger::LogWarnFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogWarn("%s", value.c_str());
+}
+
+
+void Logger::LogErrorFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogError("%s", value.c_str());
+}
+
+
+void Logger::LogAlertFV(fmt::string_view format, fmt::format_args args)
+{
+ std::string value = fmt::vformat(format, args);
+ LogAlert("%s", value.c_str());
+}
+
+
string Logger::GetName()
{
char* name = BNLoggerGetName(m_object);