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:
parent
fa15331793
commit
fa062daa99
|
@ -196,7 +196,7 @@ class Trace ( object ):
|
||||||
|
|
||||||
def write ( self, level, arg1='', arg2=None ):
|
def write ( self, level, arg1='', arg2=None ):
|
||||||
if level < self._level: return
|
if level < self._level: return
|
||||||
|
sys.stdout.flush()
|
||||||
sflags = [ '', '' ]
|
sflags = [ '', '' ]
|
||||||
message = None
|
message = None
|
||||||
if isinstance(arg1,str) and len(arg1) and arg1[0] in '+-,':
|
if isinstance(arg1,str) and len(arg1) and arg1[0] in '+-,':
|
||||||
|
@ -205,22 +205,18 @@ class Trace ( object ):
|
||||||
message = arg2
|
message = arg2
|
||||||
else:
|
else:
|
||||||
message = arg1
|
message = arg1
|
||||||
|
|
||||||
for f in sflags[0]:
|
for f in sflags[0]:
|
||||||
if f == '+': self._tab.inc()
|
if f == '+': self._tab.inc()
|
||||||
if f == '-': self._tab.dec()
|
if f == '-': self._tab.dec()
|
||||||
|
|
||||||
if message:
|
if message:
|
||||||
if not isinstance(message,str):
|
if not isinstance(message,str):
|
||||||
message = '\t'+str(message)+'\n'
|
message = '\t'+str(message)+'\n'
|
||||||
|
|
||||||
if len(message) and message[0] == '\t':
|
if len(message) and message[0] == '\t':
|
||||||
sys.stderr.write( str(self._tab) )
|
sys.stderr.write( str(self._tab) )
|
||||||
sys.stderr.write( message[1:] )
|
sys.stderr.write( message[1:] )
|
||||||
else:
|
else:
|
||||||
sys.stderr.write( message )
|
sys.stderr.write( message )
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
||||||
for f in sflags[1]:
|
for f in sflags[1]:
|
||||||
if f == '+': self._tab.inc()
|
if f == '+': self._tab.inc()
|
||||||
if f == '-': self._tab.dec()
|
if f == '-': self._tab.dec()
|
||||||
|
|
|
@ -256,6 +256,7 @@ class CfgCache ( object ):
|
||||||
CfgCache.setCfgParameter( self._path+'.'+attrName,self._rattr[attrName] )
|
CfgCache.setCfgParameter( self._path+'.'+attrName,self._rattr[attrName] )
|
||||||
if not len(self._path) and priority is not None:
|
if not len(self._path) and priority is not None:
|
||||||
Cfg.Configuration.popDefaultPriority()
|
Cfg.Configuration.popDefaultPriority()
|
||||||
|
#self.display()
|
||||||
|
|
||||||
def display ( self ):
|
def display ( self ):
|
||||||
"""Print all the parameters stored in that CfgCache."""
|
"""Print all the parameters stored in that CfgCache."""
|
||||||
|
|
Loading…
Reference in New Issue