From fa062daa9937c028a2033f7701bd7241a6324c30 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 11 Aug 2020 14:47:03 +0200 Subject: [PATCH] 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. --- crlcore/python/helpers/__init__.py | 6 +----- crlcore/python/helpers/overlay.py | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/crlcore/python/helpers/__init__.py b/crlcore/python/helpers/__init__.py index cdddc6b3..61269562 100644 --- a/crlcore/python/helpers/__init__.py +++ b/crlcore/python/helpers/__init__.py @@ -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() diff --git a/crlcore/python/helpers/overlay.py b/crlcore/python/helpers/overlay.py index 3950a26a..56d10c0d 100644 --- a/crlcore/python/helpers/overlay.py +++ b/crlcore/python/helpers/overlay.py @@ -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."""