Changed logger init and added verbose arg handling

Initialized logger with default value of NOTSET.

Added if statement to handle verbose argument and set the logger to
DEBUG.

Change-Id: I997b8b964dade013db265d088d00ccfdd6ab030e
Closes-Bug: #1269465
This commit is contained in:
twm2016 2016-02-24 13:22:43 -06:00
parent 43c79ad94c
commit 7a604b2d5c
1 changed files with 6 additions and 2 deletions

View File

@ -29,8 +29,7 @@ from boto.ec2 import cloudwatch
log_format = '%(levelname)s [%(asctime)s] %(message)s'
log_file_name = "/var/log/cfn-push-stats.log"
logging.basicConfig(filename=log_file_name,
format=log_format,
level=logging.DEBUG)
format=log_format)
LOG = logging.getLogger('cfntools')
try:
@ -108,6 +107,11 @@ credentials = cfn_helper.parse_creds_file(args.credential_file)
namespace = 'system/linux'
data = {}
# Logging
# =======
if args.verbose:
LOG.setLevel(logging.DEBUG)
# Generic user-specified metric
# =============================
if args.metric and args.units and args.value: