code: func (l *Ledis) ReadLogsTo(startLogID uint64, w io.Writer) (n int, nextLogID uint64, err error) {
  	if !l.ReplicationUsed() {
  		// no replication log
  		nextLogID = 0
  		err = ErrRplNotSupport
  		return
  	}
  
  	var firtID, lastID uint64
  
  	firtID, err = l.r.FirstLogID()
  	if err != nil {
  		return
  	}
  
  	if startLogID < firtID {
  		err = ErrLogMissed
  		return
  	}
  
  	lastID, err = l.r.LastLogID()
  	if err != nil {
  		return
  	}
  
  	nextLogID = startLogID
  
  	log := &rpl.Log{}
  	for i := startLogID; i <= lastID; i++ {
  		if err = l.r.GetLog(i, log); err != nil {
  			return
  		}
  
  		if err = log.Encode(w); err != nil {
  			return
  		}
  
  		nextLogID = i + 1
  
  		n += log.Size()
  
  		if n > maxReplLogSize {
  			break
  		}
  	}
  
  	return
  }
docs: // ReadLogsTo reads logs and write to the Writer.