   "Path to the sqlite3 executable.")
 
 (cl-defstruct (emacsql (:constructor emacsql--create))
-  process file)
+  process file log)
 
 (defvar emacsql-connections ()
   "Collection of all known emacsql connections.

  "Retrieve value from REF."
  (gethash t ref))

(defun emacsql-connect (file)
  "Open a connected to database stored in FILE."
  (emacsql-start-reap-timer)
  (let* ((buffer (generate-new-buffer "*emacsql-connection*"))
         (process (start-process "emacsql" buffer sqlite-program-name file)))

    (cancel-timer emacsql-reap-timer)
    (setf emacsql-reap-timer nil)))

(defun emacsql--log (emacsql &rest messages)
  (let ((log (emacsql-log emacsql)))
    (when log
      (with-current-buffer log
        (setf (point) (point-max))
        (mapc (lambda (s) (princ s log)) messages)))))

(defun emacsql--send (emacsql string)
  "Send STRING to EMACSQL, automatically appending newline."
  (let ((process (emacsql-process emacsql)))
    (emacsql--log emacsql string "\n")
    (process-send-string process string)
    (process-send-string process "\n")))

