コード例 #1
0
    def shouldRollover(self, record):
        """
        Check the need to rotate.     
        """
        timed_rollover = TimedRotatingFileHandler.shouldRollover(self, record)
        sized_rollover = RotatingFileHandler.shouldRollover(self, record)

        return timed_rollover or sized_rollover
コード例 #2
0
ファイル: Logger.py プロジェクト: saiyanprince/pyimager
  def shouldRollover(self, record):
    if TimedRotatingFileHandler.shouldRollover(self, record):
      return 1

    msg = "%s\n" % self.format(record)

    if self.stream.tell() + len(msg) >= self.maxBytes:
      return 1

    return 0  
コード例 #3
0
ファイル: Logger.py プロジェクト: venkatarajasekhar/pyimager
    def shouldRollover(self, record):
        if TimedRotatingFileHandler.shouldRollover(self, record):
            return 1

        msg = "%s\n" % self.format(record)

        if self.stream.tell() + len(msg) >= self.maxBytes:
            return 1

        return 0
コード例 #4
0
 def _shouldRollover(self):
     """
     Determine whether a rollover should occur. This is an overwrite
     of the method used by ConcurrentRotatingFileHandler, in order to
     make it use time.
     """
     if(TimedRotatingFileHandler.shouldRollover(self, None)):
         return True
     else:
         self._degrade(False, "Rotation done or not needed at this time")
     return False
コード例 #5
0
ファイル: logger.py プロジェクト: Alberto-Beralix/Beralix
    def shouldRollover(self, record):
        """
        Determine if rollover should occur.

        Basically, see if TimedRotatingFileHandler.shouldRollover and if it's
        False see if the supplied record would cause the file to exceed
        the size limit we have.

        The size based rotation are from logging.handlers.RotatingFileHandler
        """
        if TimedRotatingFileHandler.shouldRollover(self, record):
            return 1
        else:
            # check the size
            if self.stream is None:                 # delay was set...
                self.stream = self._open()
            if self.maxBytes > 0:                   # are we rolling over?
                msg = "%s\n" % self.format(record)
                self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
                if self.stream.tell() + len(msg) >= self.maxBytes:
                    return 1
            return 0
コード例 #6
0
 def shouldRollover(self, record):
     return TimedRotatingFileHandler.shouldRollover(
         self, record) or RotatingFileHandler.shouldRollover(self, record)
コード例 #7
0
 def shouldRollover(self, record):
     return bool(TimedRotatingFileHandler.shouldRollover(self, record)) or \
            bool(RotatingFileHandler.shouldRollover(self, record))
コード例 #8
0
 def shouldRollover(self, record):
     """ Determine if rollover should occur. """
     return (TimedRotatingFileHandler.shouldRollover(self, record)
             or RotatingFileHandler.shouldRollover(self, record))
コード例 #9
0
 def shouldRollover(self, record):
     """
     description : determines when to roll over (overloading)
     """
     return TimedRotatingFileHandler.shouldRollover(self, record) \
             or RotatingFileHandler.shouldRollover(self, record)
コード例 #10
0
ファイル: pnm_v2.py プロジェクト: PMacHarrie/NPG-BK
    # Main loop

    i = 0

    #print "loop through priorities"

    #       print "jb=", json.dumps(jb, indent=2)
    #       for x in sorted(jb["jobPriority"]):
    #               print "priority", x, jb["jobPriority"][x]

    #       exit(1)

    while (True):

        if (rfh.shouldRollover(rfh)):
            logit('Log Roll Over!')
            LOG = open(rfh.baseFilename, 'a')
    # If a job box is free, and there is a job to run, get it and run it.

        if jb['free'] > 0:
            jobId = getJob()
            if jobId > 0:
                myjb = getJobBox(jobId)
                #logit("Assigned Job:" + str(jobId))
                #print "jb=", jb
                jobIdStr = str(jobId)
                jb[myjb]['p'] = mp.Process(target=runProductionJob,
                                           args=(jobId, ))
                #print "called Process"
                jb[myjb]['p'].start()