Skip to content

Commit

Permalink
make it easier to see ES docs when debugging wrapper
Browse files Browse the repository at this point in the history
set log level to DEBUG if snafu_debug env. var. defined
otherwise set it to INFO
  • Loading branch information
bengland2 committed Oct 21, 2019
1 parent ec77962 commit 913308e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions run_snafu.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
urllib3_log = logging.getLogger("urllib3")
urllib3_log.setLevel(logging.CRITICAL)

setup_loggers("snafu", logging.DEBUG)
if os.getenv("snafu_debug") != None:
setup_loggers("snafu", logging.DEBUG)
logger.info("logging level is DEBUG")
else:
setup_loggers("snafu", logging.INFO)
logger.info("logging level is INFO")

def main():

Expand Down Expand Up @@ -108,7 +113,7 @@ def process_generator(index_args, parser):
"_source": action,
"_id": "" }
es_valid_document["_id"] = hashlib.md5(str(action).encode()).hexdigest()
#logger.debug(json.dumps(es_valid_document, indent=4))
logger.debug(json.dumps(es_valid_document, indent=4))
yield es_valid_document

def generate_wrapper_object(index_args, parser):
Expand Down

0 comments on commit 913308e

Please sign in to comment.