Example #1
0
func (l *Logic) entryToDisk(entry comm.Entry) {
	glog.Info("log to disk")
	if l.file == nil {
		f, err := os.OpenFile("logentry.data", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
		if err != nil {
			glog.Error(err)
			return
		}
		l.file = f
	}

	data, err := entry.Serialise()
	if err != nil {
		glog.Info("failed to serialise of entry:", entry)
		return
	}
	glog.Info(string(data))
	l.file.WriteString(data + "\n")
}