From 286b320d8bc1542ca0560455a7decde8a5e70643 Mon Sep 17 00:00:00 2001 From: Eesaan Atluri <atlurie@uab.edu> Date: Mon, 13 Apr 2020 23:48:26 +0000 Subject: [PATCH] Use rc_util class methods for logging and arg parsing in bright account create agent --- brightcm_account_create.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/brightcm_account_create.py b/brightcm_account_create.py index 2e68459..ed6c71b 100644 --- a/brightcm_account_create.py +++ b/brightcm_account_create.py @@ -3,6 +3,7 @@ import sys import json import logging import argparse +import rc_util from os import popen from rc_rmq import RCRMQ @@ -12,22 +13,10 @@ task = 'bright_account' rc_rmq = RCRMQ({'exchange': 'RegUsr', 'exchange_type': 'topic'}) # Parse arguments -parser = argparse.ArgumentParser() -parser.add_argument('-v', '--verbose', action='store_true', help='verbose output') -parser.add_argument('-n', '--dry-run', action='store_true', help='enable dry run mode') -args = parser.parse_args() - -#Default Log level -log_lvl = logging.WARNING - -if args.verbose: - log_lvl = logging.DEBUG -if args.dry_run: - log_lvl = logging.INFO +args = rc_util.get_args() # Logger -logging.basicConfig(format='%(asctime)s %(levelname)s [%(module)s] - %(message)s', level=log_lvl) -logger = logging.getLogger(__name__) +logger = rc_util.get_logger() # Define your callback function def bright_account_create(ch, method, properties, body): -- GitLab