func newLog(storage Storage, logger Logger) *raftLog {
	if storage == nil {
		log.Panic("storage must not be nil")
	}
	log := &raftLog{
		storage: storage,
		logger:  logger,
	}
	firstIndex, err := storage.FirstIndex()
	if err != nil {
		panic(err)  
	}
	lastIndex, err := storage.LastIndex()
	if err != nil {
		panic(err)  
	}
	log.unstable.offset = lastIndex + 1
	log.unstable.logger = logger
	log.committed = firstIndex - 1
	log.applied = firstIndex - 1
	return log
}
newLog returns log using the given storage. It recovers the log to the state
that it just commits and applies the latest snapshot.
package raft
import (
	"fmt"
	"log"
	pb "github.com/coreos/etcd/raft/raftpb"
)
type raftLog struct {
	storage Storage
	unstable unstable
	committed uint64
	applied uint64
	logger Logger
}