From da39c4b195cdd04290cfb285ac33b455f7bfc3cd Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Thu, 10 Feb 2022 09:18:06 -0500 Subject: fixes #2959; some type checking on log APIs --- python/log.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'python/log.py') diff --git a/python/log.py b/python/log.py index 04d8693a..98aef1eb 100644 --- a/python/log.py +++ b/python/log.py @@ -53,6 +53,8 @@ def log(level, text): :param str text: message to print :rtype: None """ + if not isinstance(text, str): + text = str(text) core.BNLogString(level, text) @@ -68,6 +70,8 @@ def log_debug(text): >>> log_debug("Hotdogs!") Hotdogs! """ + if not isinstance(text, str): + text = str(text) core.BNLogString(LogLevel.DebugLog, text) @@ -83,6 +87,8 @@ def log_info(text): Saucisson! >>> """ + if not isinstance(text, str): + text = str(text) core.BNLogString(LogLevel.InfoLog, text) @@ -99,6 +105,8 @@ def log_warn(text): Chilidogs! >>> """ + if not isinstance(text, str): + text = str(text) core.BNLogString(LogLevel.WarningLog, text) @@ -115,6 +123,8 @@ def log_error(text): Spanferkel! >>> """ + if not isinstance(text, str): + text = str(text) core.BNLogString(LogLevel.ErrorLog, text) @@ -131,6 +141,8 @@ def log_alert(text): Kielbasa! >>> """ + if not isinstance(text, str): + text = str(text) core.BNLogString(LogLevel.AlertLog, text) -- cgit v1.3.1