Beispiel #1
0
    def printDebug(self, msg, statusLevel=common.DEBUG_USER, debugFormat=None):
        '''
        Format one or more data elements into string, and print it 
        to stderr. The first arg can be a list of strings or a string; 
        lists are concatenated with common.formatStr(). 
        '''
        #if not common.isNum(statusLevel):
        #    raise EnvironmentException('bad statusLevel argument given: %s' % statusLevel)
        #         if self.__getitem__('debug') >= statusLevel:
        #             if common.isStr(msg):
        #                 msg = [msg] # make into a list
        #             if msg[0] != self.modNameParent and self.modNameParent != None:
        #                 msg = [self.modNameParent + ':'] + msg
        #             # pass list to common.formatStr
        #             msg = common.formatStr(*msg, format=debugFormat)
        #             sys.stderr.write(msg)

        if _environStorage['instance'].__getitem__('debug') >= statusLevel:
            if common.isStr(msg):
                msg = [msg]  # make into a list
            if msg[0] != self.modNameParent and self.modNameParent != None:
                msg = [self.modNameParent + ':'] + msg
            # pass list to common.formatStr
            msg = common.formatStr(*msg, format=debugFormat)
            sys.stderr.write(msg)
    def printDebug(self, msg, statusLevel=common.DEBUG_USER, debugFormat=None):
        '''
        Format one or more data elements into string, and print it 
        to stderr. The first arg can be a list of strings or a string; 
        lists are concatenated with common.formatStr(). 
        '''
        #if not common.isNum(statusLevel):
        #    raise EnvironmentException('bad statusLevel argument given: %s' % statusLevel)
#         if self.__getitem__('debug') >= statusLevel:
#             if common.isStr(msg):
#                 msg = [msg] # make into a list
#             if msg[0] != self.modNameParent and self.modNameParent != None:
#                 msg = [self.modNameParent + ':'] + msg
#             # pass list to common.formatStr
#             msg = common.formatStr(*msg, format=debugFormat)
#             sys.stderr.write(msg)

        if _environStorage['instance'].__getitem__('debug') >= statusLevel:
            if common.isStr(msg):
                msg = [msg] # make into a list
            if msg[0] != self.modNameParent and self.modNameParent != None:
                msg = [self.modNameParent + ':'] + msg
            # pass list to common.formatStr
            msg = common.formatStr(*msg, format=debugFormat)
            sys.stderr.write(msg)
Beispiel #3
0
 def warn(self, msg):
     '''To print a warning to the user, send a list of strings to this
     method. 
     '''
     if common.isStr(msg):
         msg = [msg] # make into a list
     if msg[0] != self.modNameParent and self.modNameParent != None:
         msg = [self.modNameParent + ': WARNING:'] + msg
     msg = common.formatStr(*msg)
     sys.stderr.write(msg)
Beispiel #4
0
 def warn(self, msg, header=None):
     '''To print a warning to the user, send a list of strings to this
     method. Similar to printDebug but even if debug is off.
     '''
     if common.isStr(msg):
         msg = [msg] # make into a list
     if header == None:
         if msg[0] != self.modNameParent and self.modNameParent != None:
             msg = [self.modNameParent + ': WARNING:'] + msg
     else:
         msg = [header] + msg
     msg = common.formatStr(*msg)
     sys.stderr.write(msg)
Beispiel #5
0
 def printDebug(self, msg, statusLevel=common.DEBUG_USER, debugFormat=None):
     '''
     Format one or more data elements into string, and print it to stderr.
     The first arg can be a list of strings or a string; lists are
     concatenated with common.formatStr().
     '''
     if _environStorage['instance'].__getitem__('debug') >= statusLevel:
         if isinstance(msg, six.string_types):
             msg = [msg]  # make into a list
         if msg[0] != self.modNameParent and self.modNameParent is not None:
             msg = [self.modNameParent + ':'] + msg
         # pass list to common.formatStr
         msg = common.formatStr(*msg, format=debugFormat)
         sys.stderr.write(msg)
Beispiel #6
0
 def printDebug(self, msg, statusLevel=common.DEBUG_USER, debugFormat=None):
     '''
     Format one or more data elements into string, and print it to stderr.
     The first arg can be a list of strings or a string; lists are
     concatenated with common.formatStr().
     '''
     if _environStorage['instance'].__getitem__('debug') >= statusLevel:
         if isinstance(msg, six.string_types):
             msg = [msg]  # make into a list
         if msg[0] != self.modNameParent and self.modNameParent is not None:
             msg = [self.modNameParent + ':'] + msg
         # pass list to common.formatStr
         msg = common.formatStr(*msg, format=debugFormat)
         sys.stderr.write(msg)
Beispiel #7
0
 def printDebug(self, msg, statusLevel=common.DEBUG_USER):
     '''Format one or more data elements into string, and print it 
     to stderr. The first arg can be a list of string; lists are 
     concatenated with common.formatStr(). 
     '''
     if not common.isNum(statusLevel):
         raise EnvironmentException('bad statusLevel argument given: %s' % statusLevel)
     if self.__getitem__('debug') >= statusLevel:
         if common.isStr(msg):
             msg = [msg] # make into a list
         if msg[0] != self.modNameParent and self.modNameParent != None:
             msg = [self.modNameParent + ':'] + msg
 
         msg = common.formatStr(*msg)
         sys.stderr.write(msg)
Beispiel #8
0
 def warn(self, msg, header=None):
     '''
     To print a warning to the user, send a list of strings to this
     method. Similar to printDebug but even if debug is off.
     '''
     if common.isStr(msg):
         msg = [msg]  # make into a list
     elif isinstance(msg, dict):
         msg = [repr(msg)]
     if header == None:
         if msg[0] != self.modNameParent and self.modNameParent != None:
             msg = [self.modNameParent + ': WARNING:'] + msg
     else:
         msg = [header] + msg
     msg = common.formatStr(*msg)
     sys.stderr.write(msg)
Beispiel #9
0
 def warn(self, msg, header=None):
     '''
     To print a warning to the user, send a list of strings to this method.
     Similar to printDebug but even if debug is off.
     '''
     if isinstance(msg, six.string_types):
         msg = [msg]  # make into a list
     elif isinstance(msg, dict):
         msg = [repr(msg)]
     elif common.isNum(msg):
         msg = [str(msg)]
     if header is None:
         if msg[0] != self.modNameParent and self.modNameParent is not None:
             msg = [self.modNameParent + ': WARNING:'] + msg
     else:
         msg = [header] + msg
     msg = common.formatStr(*msg)
     sys.stderr.write(msg)