Tweaks in CRL/helpers Trace & CfgCache.

* Change: In CRL/helpers.Trace, flush stderr before issuing the trace
    message to avoid mixing up stdout & stderr (sometimes misleading).
* Change: In CRL/helpers.overlay.CfgCache, no longer display all the
    applied setting after a call to apply(). Too verbose.
This commit is contained in:
Jean-Paul Chaput 2020-08-11 14:47:03 +02:00
parent fa15331793
commit fa062daa99
2 changed files with 2 additions and 5 deletions

View File

@ -196,7 +196,7 @@ class Trace ( object ):
def write ( self, level, arg1='', arg2=None ):
if level < self._level: return
sys.stdout.flush()
sflags = [ '', '' ]
message = None
if isinstance(arg1,str) and len(arg1) and arg1[0] in '+-,':
@ -205,22 +205,18 @@ class Trace ( object ):
message = arg2
else:
message = arg1
for f in sflags[0]:
if f == '+': self._tab.inc()
if f == '-': self._tab.dec()
if message:
if not isinstance(message,str):
message = '\t'+str(message)+'\n'
if len(message) and message[0] == '\t':
sys.stderr.write( str(self._tab) )
sys.stderr.write( message[1:] )
else:
sys.stderr.write( message )
sys.stderr.flush()
for f in sflags[1]:
if f == '+': self._tab.inc()
if f == '-': self._tab.dec()

View File

@ -256,6 +256,7 @@ class CfgCache ( object ):
CfgCache.setCfgParameter( self._path+'.'+attrName,self._rattr[attrName] )
if not len(self._path) and priority is not None:
Cfg.Configuration.popDefaultPriority()
#self.display()
def display ( self ):
"""Print all the parameters stored in that CfgCache."""