summaryrefslogtreecommitdiffstats
path: root/nfvbench/nfvbench.py
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2017-08-15 15:52:12 -0700
committerahothan <ahothan@cisco.com>2017-08-15 15:52:12 -0700
commit4c5e4ba753face81fd73aa3bae1fe3c012e48859 (patch)
tree7c13bb498a7eb89e1b9a5debaba877e483358aab /nfvbench/nfvbench.py
parentee54ef3cc13c0633f664264dfb450f3d2fab13bc (diff)
NFVBENCH-4 Add support for log file
Change-Id: Id630944944d472322a763fe41ccb0e1ed9fb3066 Signed-off-by: ahothan <ahothan@cisco.com>
Diffstat (limited to 'nfvbench/nfvbench.py')
-rw-r--r--nfvbench/nfvbench.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py
index 5b7eb91..a4f9ead 100644
--- a/nfvbench/nfvbench.py
+++ b/nfvbench/nfvbench.py
@@ -121,8 +121,8 @@ class NFVBench(object):
def print_summary(self, result):
"""Print summary of the result"""
- print NFVBenchSummarizer(result)
- sys.stdout.flush()
+ summary = NFVBenchSummarizer(result)
+ LOG.info(str(summary))
def save(self, result):
"""Save results in json format file."""
@@ -365,6 +365,11 @@ def parse_opts_from_cli():
default=None,
help='Override traffic profile direction (requires -fs)')
+ parser.add_argument('--log-file', '--logfile', dest='log_file',
+ action='store',
+ help='Filename for saving logs',
+ metavar='<log_file>')
+
opts, unknown_opts = parser.parse_known_args()
return opts, unknown_opts
@@ -406,7 +411,7 @@ def check_physnet(name, netattrs):
def main():
try:
- log.setup('nfvbench')
+ log.setup()
# load default config file
config, default_cfg = load_default_config()
# create factory for platform specific classes
@@ -422,7 +427,7 @@ def main():
openstack_spec = config_plugin.get_openstack_spec()
opts, unknown_opts = parse_opts_from_cli()
- log.set_level('nfvbench', debug=opts.debug)
+ log.set_level(debug=opts.debug)
if opts.version:
print pbr.version.VersionInfo('nfvbench').version_string_with_vcs()
@@ -457,6 +462,8 @@ def main():
config.generator_profile = opts.generator_profile
if opts.sriov:
config.sriov = True
+ if opts.log_file:
+ config.log_file = opts.log_file
# show running config in json format
if opts.show_config:
@@ -475,6 +482,10 @@ def main():
# in a copy of the dict (config plugin still holds the original dict)
config_plugin.set_config(config)
+ # add file log if requested
+ if config.log_file:
+ log.add_file_logger(config.log_file)
+
nfvbench = NFVBench(config, openstack_spec, config_plugin, factory)
if opts.server: