1616
1717
1818def tuple_property (attrs ):
19-
2019 def getter (self ):
2120 tup = tuple (getattr (self , attr ) for attr in attrs )
2221 if all (tup ):
@@ -77,10 +76,11 @@ def is_client(self):
7776 def is_server (self ):
7877 return 'uas' in self .name .lower ()
7978
80- def iter_logfile_items (self , types_attr = '_log_types' ):
79+ def iter_logfile_items (self , types_attr = '_log_types' , enable_screen_file = True ):
8180 for name in getattr (self , types_attr ):
82- attr_name = name + '_file'
83- yield attr_name , getattr (self , attr_name )
81+ if name != 'screen' or enable_screen_file :
82+ attr_name = name + '_file'
83+ yield attr_name , getattr (self , attr_name )
8484
8585 def iter_toconsole_items (self ):
8686 yield 'screen_file' , self .screen_file
@@ -118,11 +118,11 @@ def enable_tracing(self):
118118 attr_name = 'trace_' + name
119119 setattr (self , attr_name , True )
120120
121- def enable_logging (self , logdir = None , debug = False ):
121+ def enable_logging (self , logdir = None , debug = False , enable_screen_file = True ):
122122 """Enable agent logging by appending appropriately named log file
123123 arguments to the underlying command.
124124 """
125- logattrs = self .iter_logfile_items ()
125+ logattrs = self .iter_logfile_items (enable_screen_file = enable_screen_file )
126126 if debug :
127127 logattrs = itertools .chain (
128128 logattrs ,
@@ -233,8 +233,9 @@ class ScenarioType(object):
233233
234234 If called it will invoke the standard run hooks.
235235 """
236+
236237 def __init__ (self , agents , defaults , clientdefaults = None ,
237- serverdefaults = None , confpy = None ):
238+ serverdefaults = None , confpy = None , enable_screen_file = True ):
238239 # agents iterable in launch-order
239240 self ._agents = agents
240241 ua_attrs = UserAgent .keys ()
@@ -253,6 +254,7 @@ def __init__(self, agents, defaults, clientdefaults=None,
253254
254255 # hook module
255256 self .mod = confpy
257+ self .enable_screen_file = enable_screen_file
256258
257259 @property
258260 def agents (self ):
@@ -330,6 +332,7 @@ def prepare_agent(self, agent):
330332 """Return a new agent with all default settings applied from this
331333 scenario
332334 """
335+
333336 def merge (dicts ):
334337 """Merge dicts without clobbering up to 1 level deep's worth of
335338 sub-dicts
@@ -364,7 +367,8 @@ def merge(dicts):
364367 params = merge (ordered )
365368 log .debug ("merged contents:\n {}" .format (params ))
366369 ua = UserAgent (defaults = params )
367- ua .enable_logging ()
370+
371+ ua .enable_logging (enable_screen_file = self .enable_screen_file )
368372
369373 # call post defaults hook
370374 plugin .mng .hook .pysipp_post_ua_defaults (ua = ua )
0 commit comments