Ejemplo n.º 1
0
    def __init__(self, category, label=None, manual_reprime=0, nofail=1,
                 immediate=1):
	"""If specified, optional label is included after timestamp.
        Other options are passed to the Logger class initializer.
        """
	self.__label = label
        self.__manual_reprime = manual_reprime
        self.__primed = 1
        self.__bol = 1
	Logger.__init__(self, category, nofail, immediate)
Ejemplo n.º 2
0
 def writelines(self, lines):
     first = 1
     for l in lines:
         if first:
             self.write(l)
             first = 0
         else:
             if l and l[0] not in [' ', '\t', '\n']:
                 Logger.write(self, ' ' + l)
             else:
                 Logger.write(self, l)
Ejemplo n.º 3
0
    def writelines(self, lines):
	first = 1
	for l in lines:
	    if first:
		self.write(l)
		first = 0
	    else:
		if l and l[0] not in [' ', '\t', '\n']:
		    Logger.write(self, ' ' + l)
		else:
		    Logger.write(self, l)
Ejemplo n.º 4
0
 def __init__(self,
              category,
              label=None,
              manual_reprime=0,
              nofail=1,
              immediate=1):
     """If specified, optional label is included after timestamp.
     Other options are passed to the Logger class initializer.
     """
     self.__label = label
     self.__manual_reprime = manual_reprime
     self.__primed = 1
     self.__bol = 1
     Logger.__init__(self, category, nofail, immediate)
Ejemplo n.º 5
0
 def write(self, msg):
     if not self.__bol:
         prefix = ""
     else:
         if not self.__manual_reprime or self.__primed:
             stamp = time.strftime("%b %d %H:%M:%S %Y ",
                                   time.localtime(time.time()))
             self.__primed = 0
         else:
             stamp = ""
         if self.__label is None:
             label = "(%d)" % os.getpid()
         else:
             label = "%s(%d):" % (self.__label, os.getpid())
         prefix = stamp + label
     Logger.write(self, "%s %s" % (prefix, msg))
     if msg and msg[-1] == '\n':
         self.__bol = 1
     else:
         self.__bol = 0
Ejemplo n.º 6
0
 def write(self, msg):
     if not self.__bol:
         prefix = ""
     else:
         if not self.__manual_reprime or self.__primed:
             stamp = time.strftime("%b %d %H:%M:%S %Y ",
                                   time.localtime(time.time()))
             self.__primed = 0
         else:
             stamp = ""
         if self.__label is None:
             label = "(%d)" % os.getpid()
         else:
             label = "%s(%d):" % (self.__label, os.getpid())
         prefix = stamp + label
     Logger.write(self, "%s %s" % (prefix, msg))
     if msg and msg[-1] == '\n':
         self.__bol = 1
     else:
         self.__bol = 0