aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/mocks/mass-pnf-sim/mass-pnf-sim.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/mocks/mass-pnf-sim/mass-pnf-sim.py b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
index c4fb0ded8..db567ede0 100755
--- a/test/mocks/mass-pnf-sim/mass-pnf-sim.py
+++ b/test/mocks/mass-pnf-sim/mass-pnf-sim.py
@@ -8,8 +8,6 @@ import logging
from requests import get
from requests.exceptions import MissingSchema, InvalidSchema, InvalidURL, ConnectionError, ConnectTimeout
-logging.basicConfig(level=logging.INFO, format='\033[92m[%(levelname)s]\033[0m %(message)s')
-
def validate_url(url):
'''Helper function to perform --urlves input param validation'''
logger = logging.getLogger("urllib3")
@@ -31,6 +29,11 @@ def validate_ip(ip):
else:
return ip_valid
+if sys.stdout.isatty():
+ logging.basicConfig(level=logging.INFO, format='\033[92m[%(levelname)s]\033[0m %(message)s')
+else:
+ logging.basicConfig(level=logging.INFO, format='[%(levelname)s] %(message)s')
+
parser = argparse.ArgumentParser()
parser.add_argument('--bootstrap', help='Bootstrap the system', type=int, metavar='COUNT')
parser.add_argument('--trigger', help='Trigger one single VES event from each simulator', type=int,
@@ -52,6 +55,7 @@ parser.add_argument('--verbose', help='Verbosity level', choices=['info', 'debug
type=str, default='debug')
args = parser.parse_args()
+
logger = logging.getLogger(__name__)
logger.setLevel(getattr(logging, args.verbose.upper()))