From a93b21091c44b599da919d325f730d155ba8f843 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 8 Dec 2017 17:17:40 +0100 Subject: [PATCH] record_base: simplify bugfixing by offering more verbosity --- oletools/record_base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/oletools/record_base.py b/oletools/record_base.py index 82a24c4..11208ac 100644 --- a/oletools/record_base.py +++ b/oletools/record_base.py @@ -74,6 +74,7 @@ except ImportError: # Helpers ############################################################################### +OleFileIO = olefile.OleFileIO STGTY_EMPTY = olefile.STGTY_EMPTY # 0 STGTY_STORAGE = olefile.STGTY_STORAGE # 1 STGTY_STREAM = olefile.STGTY_STREAM # 2 @@ -92,6 +93,10 @@ ENTRY_TYPE2STR = { STGTY_SUBSTREAM: 'substream' } +def enable_olefile_logging(): + """ enable logging olefile e.g., to get debug info from OleFileIO """ + olefile.enable_logging() + ############################################################################### # Base Classes @@ -321,13 +326,13 @@ class OleRecordBase(object): def test(filenames, ole_file_class=OleRecordFile, - must_parse=None, do_per_record=None): + must_parse=None, do_per_record=None, verbose=False): """ parse all given file names and print rough structure if an error occurs while parsing a stream of type in must_parse, the error will be raised. Otherwise a message is printed """ - logging.basicConfig(level=logging.INFO) + logging.basicConfig(level=logging.DEBUG if verbose else logging.INFO) if do_per_record is None: def do_per_record(record): pass # do nothing -- libgit2 0.21.4