summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.h15
-rw-r--r--log.cpp22
2 files changed, 36 insertions, 1 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index c9c0ea70..37b7bb71 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -479,8 +479,20 @@ namespace BinaryNinja {
#endif
void Log(BNLogLevel level, const char* fmt, ...);
+ /*! LogTrace only writes text to the error console if the console is set to log level: DebugLog
+ Log level and the build is not a DEBUG build (i.e. the preprocessor directive _DEBUG is defined)
+
+ \param fmt C-style format string.
+ \param ... Variable arguments corresponding to the format string.
+ */
+#ifdef __GNUC__
+ __attribute__((format(printf, 1, 2)))
+#endif
+ void LogTrace(const char* fmt, ...);
+
+
/*! LogDebug only writes text to the error console if the console is set to log level: DebugLog
- Log level DebugLog is the most verbose logging level.
+ Log level DebugLog is the most verbose logging level in release builds.
\param fmt C-style format string.
\param ... Variable arguments corresponding to the format string.
@@ -548,6 +560,7 @@ namespace BinaryNinja {
Logger(BNLogger* logger);
Logger(const std::string& loggerName, size_t sessionId = 0);
void Log(BNLogLevel level, const char* fmt, ...);
+ void LogTrace(const char* fmt, ...);
void LogDebug(const char* fmt, ...);
void LogInfo(const char* fmt, ...);
void LogWarn(const char* fmt, ...);
diff --git a/log.cpp b/log.cpp
index 0c6916b9..22b06bd8 100644
--- a/log.cpp
+++ b/log.cpp
@@ -106,6 +106,17 @@ void BinaryNinja::Log(BNLogLevel level, const char* fmt, ...)
}
+void BinaryNinja::LogTrace(const char* fmt, ...)
+{
+#ifdef _DEBUG
+ va_list args;
+ va_start(args, fmt);
+ PerformLog(0, DebugLog, "", 0, fmt, args);
+ va_end(args);
+#endif
+}
+
+
void BinaryNinja::LogDebug(const char* fmt, ...)
{
va_list args;
@@ -200,6 +211,17 @@ void Logger::Log(BNLogLevel level, const char* fmt, ...)
}
+void Logger::LogTrace(const char* fmt, ...)
+{
+#ifdef _DEBUG
+ va_list args;
+ va_start(args, fmt);
+ PerformLog(GetSessionId(), DebugLog, GetName(), GetThreadId(), fmt, args);
+ va_end(args);
+#endif
+}
+
+
void Logger::LogDebug(const char* fmt, ...)
{
va_list args;