From cab43f251ac74bee2ab716d65d9cce1a5ce6ac25 Mon Sep 17 00:00:00 2001 From: Sebastian Bachmann Date: Fri, 24 Nov 2017 10:25:43 +0100 Subject: [PATCH] remove some logging functions --- androauto.py | 3 --- androguard/core/androconf.py | 28 ++++------------------------ androgui.py | 3 --- androlyze.py | 3 --- 4 files changed, 4 insertions(+), 33 deletions(-) diff --git a/androauto.py b/androauto.py index e362b571..7e88184a 100755 --- a/androauto.py +++ b/androauto.py @@ -47,9 +47,6 @@ class AndroTest(auto.DirectoryAndroAnalysis): def main(options, arguments): - if options.verbose: - set_debug() - if options.directory: settings = { "my": AndroTest(options.directory), diff --git a/androguard/core/androconf.py b/androguard/core/androconf.py index 3d8ccc48..10cbba09 100644 --- a/androguard/core/androconf.py +++ b/androguard/core/androconf.py @@ -187,11 +187,6 @@ def str2long(s): return l -def random_string(): - return random.choice(string.letters) + ''.join([random.choice( - string.letters + string.digits) for i in range(10 - 1)]) - - def is_android(filename): """Return the type of the file @@ -235,19 +230,9 @@ def is_android_raw(raw): # Init Logger -logger = logging.getLogger("androguard.runtime") # logs at runtime - - -def set_lazy(): - CONF["LAZY_ANALYSIS"] = True - - -def set_debug(): - logger.setLevel(logging.DEBUG) - - -def set_info(): - logger.setLevel(logging.INFO) +# By default this logger will now be shown to the outer world (e.g. stdout) +# but you can use `show_logging()` to activate it. +logger = logging.getLogger("androguard") def show_logging(level=logging.INFO): @@ -255,7 +240,7 @@ def show_logging(level=logging.INFO): enable log messages on stdout """ h = logging.StreamHandler(stream=sys.stdout) - h.setFormatter(logging.Formatter(fmt="%(asctime)s [%(levelname)-9s] %(name)s: %(message)s")) + h.setFormatter(logging.Formatter(fmt="%(asctime)s [%(levelname)-9s] %(name)s (%(filename)s): %(message)s")) logger.addHandler(h) logger.setLevel(level) @@ -298,11 +283,6 @@ def set_options(key, value): CONF[key] = value -def save_to_disk(buff, output): - with open(output, "w") as fd: - fd.write(buff) - - def rrmdir(directory): for root, dirs, files in os.walk(directory, topdown=False): for name in files: diff --git a/androgui.py b/androgui.py index 9ecd3fdf..ecd896e2 100755 --- a/androgui.py +++ b/androgui.py @@ -18,9 +18,6 @@ if __name__ == '__main__': args = parser.parse_args() - if args.debug: - androconf.set_debug() - # We need that to save huge sessions when leaving and avoid # RuntimeError: maximum recursion depth exceeded while pickling an object # or diff --git a/androlyze.py b/androlyze.py index e84f93de..8b26a0ae 100755 --- a/androlyze.py +++ b/androlyze.py @@ -59,9 +59,6 @@ def interact(): def main(options, arguments): - if options.debug: - set_debug() - if options.shell is not None: interact()