summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2020-10-28 00:45:23 -0400
committerRusty Wagner <rusty@vector35.com>2020-10-28 20:38:12 -0400
commit1eb98a3d69d0fbcede2b9365dcf700fb73549f18 (patch)
tree55c220f6adf60ccd3ef38b6e313a6e359e33e16d
parent106a8a60c4f88cb45e3120544f05fb2ac48e6b28 (diff)
Avoid varargs in Python FFI
-rw-r--r--binaryninjacore.h2
-rw-r--r--python/log.py12
2 files changed, 8 insertions, 6 deletions
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 1a412f09..c2d95f7d 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -2507,6 +2507,8 @@ __attribute__ ((format (printf, 1, 2)))
#endif
BINARYNINJACOREAPI void BNLogAlert(const char* fmt, ...);
+ BINARYNINJACOREAPI void BNLogString(BNLogLevel level, const char* str);
+
BINARYNINJACOREAPI void BNRegisterLogListener(BNLogListener* listener);
BINARYNINJACOREAPI void BNUnregisterLogListener(BNLogListener* listener);
BINARYNINJACOREAPI void BNUpdateLogListeners(void);
diff --git a/python/log.py b/python/log.py
index f88d9fbd..aa4e2606 100644
--- a/python/log.py
+++ b/python/log.py
@@ -55,7 +55,7 @@ def log(level, text):
:param str text: message to print
:rtype: None
"""
- core.BNLog(level, '%s', text)
+ core.BNLogString(level, text)
def log_debug(text):
@@ -70,7 +70,7 @@ def log_debug(text):
>>> log_debug("Hotdogs!")
Hotdogs!
"""
- core.BNLogDebug('%s', text)
+ core.BNLogString(LogLevel.DebugLog, text)
def log_info(text):
@@ -85,7 +85,7 @@ def log_info(text):
Saucisson!
>>>
"""
- core.BNLogInfo('%s', text)
+ core.BNLogString(LogLevel.InfoLog, text)
def log_warn(text):
@@ -101,7 +101,7 @@ def log_warn(text):
Chilidogs!
>>>
"""
- core.BNLogWarn('%s', text)
+ core.BNLogString(LogLevel.WarningLog, text)
def log_error(text):
@@ -117,7 +117,7 @@ def log_error(text):
Spanferkel!
>>>
"""
- core.BNLogError('%s', text)
+ core.BNLogString(LogLevel.ErrorLog, text)
def log_alert(text):
@@ -133,7 +133,7 @@ def log_alert(text):
Kielbasa!
>>>
"""
- core.BNLogAlert('%s', text)
+ core.BNLogString(LogLevel.AlertLog, text)
def log_to_stdout(min_level=LogLevel.InfoLog):