diff options
| -rw-r--r-- | python/__init__.py | 10 | ||||
| -rw-r--r-- | python/examples/bin_info.py | 3 | ||||
| -rwxr-xr-x | suite/generator.py | 6 | ||||
| -rw-r--r-- | suite/testcommon.py | 4 |
4 files changed, 4 insertions, 19 deletions
diff --git a/python/__init__.py b/python/__init__.py index d26f5a73..f4a91250 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -164,8 +164,9 @@ def _init_plugins(): global _plugin_init if not _plugin_init: result = core.BNInitCorePlugins() - if result is True and not core_ui_enabled() and sys.stderr.isatty(): - log_to_stderr(LogLevel.InfoLog) + min_level = Settings().get_string("python.log.minLevel") + if result and min_level in LogLevel.__members__ and not core_ui_enabled() and sys.stderr.isatty(): + log_to_stderr(LogLevel[min_level]) if not os.environ.get('BN_DISABLE_USER_PLUGINS'): core.BNInitUserPlugins() core.BNInitRepoPlugins() @@ -177,11 +178,6 @@ def _init_plugins(): _destruct_callbacks = _DestructionCallbackHandler() -def disable_logging(): - '''Disable logging in headless mode. By default, logging is enabled in headless mode.''' - _init_plugins() - close_logs() - def bundled_plugin_path(): """ ``bundled_plugin_path`` returns a string containing the current plugin path inside the `install path <https://docs.binary.ninja/getting-started.html#binary-path>`_ diff --git a/python/examples/bin_info.py b/python/examples/bin_info.py index ca270493..87a0e707 100644 --- a/python/examples/bin_info.py +++ b/python/examples/bin_info.py @@ -26,7 +26,7 @@ import binaryninja.log as log from binaryninja.binaryview import BinaryViewType import binaryninja.interaction as interaction from binaryninja.plugin import PluginCommand -from binaryninja import disable_logging +from binaryninja import Settings # 2-3 compatibility from binaryninja import range @@ -77,7 +77,6 @@ def display_bininfo(bv): if __name__ == "__main__": - disable_logging() print(get_bininfo(None)) else: PluginCommand.register("Binary Info", "Display basic info about the binary", display_bininfo) diff --git a/suite/generator.py b/suite/generator.py index 7f91a97f..a349789e 100755 --- a/suite/generator.py +++ b/suite/generator.py @@ -125,17 +125,12 @@ class TestBinaryNinjaAPI(unittest.TestCase): if __name__ == "__main__": api_only = False - disable_logging = True if len(sys.argv) > 1: for i in range(1, len(sys.argv)): if sys.argv[i] == '-v' or sys.argv[i] == '-V' or sys.argv[i] == '--verbose': config.verbose = True elif sys.argv[i] == '--api-only': config.api_only = True - elif sys.argv[i] == '--log': - disable_logging = False - if disable_logging: - testcommon.disable_logging() test_suite = unittest.defaultTestLoader.loadTestsFromModule(api_test) test_suite = unittest.defaultTestLoader.loadTestsFromModule(rebasing_test) @@ -327,7 +322,6 @@ def generate(test_store, outdir, exclude_binaries): def main(): - testcommon.disable_logging() usage = "usage: %prog [-q] [-x] [-o <dir>] [-i <dir>]" parser = OptionParser(usage=usage) default_output = os.path.relpath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, "suite")) diff --git a/suite/testcommon.py b/suite/testcommon.py index 4b49213e..78bfb19b 100644 --- a/suite/testcommon.py +++ b/suite/testcommon.py @@ -59,10 +59,6 @@ def fixStrRepr(string): # Python 2 and Python 3 represent Unicode character reprs differently return string.replace(b"\xe2\x80\xa6".decode("utf8"), "\\xe2\\x80\\xa6") - -def disable_logging(): - binja.disable_logging() - def get_file_list(test_store_rel): test_store = os.path.join(os.path.dirname(__file__), test_store_rel) all_files = [] |
