def _readProcessLog(self, name, offset, length, channel): group, process = self._getGroupAndProcess(name) logfile = getattr(process.config, '%s_logfile' % channel) if logfile is None or not os.path.exists(logfile): raise RPCError(Faults.NO_FILE, logfile) try: return readFile(logfile, int(offset), int(length)) except ValueError, inst: why = inst.args[0] raise RPCError(getattr(Faults, why))
def readLog(self, offset, length): """ Read length bytes from the main log starting at offset @param int offset offset to start reading from. @param int length number of bytes to read from the log. @return string result Bytes of log """ self._update('readLog') logfile = self.supervisord.options.logfile if logfile is None or not os.path.exists(logfile): raise RPCError(Faults.NO_FILE, logfile) try: return readFile(logfile, int(offset), int(length)) except ValueError, inst: why = inst.args[0] raise RPCError(getattr(Faults, why))