Ejemplo n.º 1
0
def _log(cls, msg):
    '''
    Generic logging function.
    @param cls:   Priority class for the message
    @param msg:   Log message text
    '''
    msg = utf8(msg)
    timeprefix = "[%12.6f] " % (time.time() - _initTime)
    if not quiet:
        print timeprefix + displaylabels[cls] + " " + msg
    print >> logFile, timeprefix + labels[cls] + " " + msg
    logFile.flush()  #stump: truncated logfiles be gone!
Ejemplo n.º 2
0
def _log(cls, msg):
    '''
    Generic logging function.
    @param cls:   Priority class for the message
    @param msg:   Log message text
    '''
    msg = utf8(msg)
    timeprefix = "[%12.6f] " % (time.time() - _initTime)
    if not quiet:
        print timeprefix + displaylabels[cls] + " " + msg
    print >>logFile, timeprefix + labels[cls] + " " + msg
    logFile.flush()  #stump: truncated logfiles be gone!
Ejemplo n.º 3
0
    def set(self, section, option, value):
        """
        Set the value of a configuration key.

        @param section:   Section name
        @param option:    Option name
        @param value:     Value name
        """

        try:
            prototype[section][option]
        except KeyError:
            Log.error("Config key %s.%s not defined while writing %s." % (section, option, self.fileName))
            raise

        if not self.config.has_section(section):
            self.config.add_section(section)

        self.config.set(section, option, utf8(value))

        f = open(self.fileName, "w")
        self.config.write(f, self.type)
        f.close()
Ejemplo n.º 4
0
 def set(self, section, option, value=None):
     if value is not None:
         value = utf8(value)
     RawConfigParser.set(self, section, option, value)