Blob Blame History Raw
From 7a604b2d5cb3468bedcdc91c858a8a29c5bbcd05 Mon Sep 17 00:00:00 2001
From: twm2016 <TM2086@att.com>
Date: Wed, 24 Feb 2016 13:22:43 -0600
Subject: [PATCH 01/21] 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
---
 bin/cfn-push-stats | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bin/cfn-push-stats b/bin/cfn-push-stats
index da0d155..501a366 100755
--- a/bin/cfn-push-stats
+++ b/bin/cfn-push-stats
@@ -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:
-- 
2.20.1