 
 (defun lean-server-process-received-message (buf str)
   "Process received message from lean-server"
-  (lean-server-log "Received String: %s" str)
+  (lean-server-log "%s:\n%s\n"
+                   (propertize "Received Message" 'face 'font-lock-variable-name-face)
+                   str)
   (setq lean-global-server-buffer (concat lean-global-server-buffer str)))
 
 (defun lean-server-output-filter (process string)

(defvar-local lean-server-trace-buffer-name "*lean-server-trace*")
(defvar-local lean-server-debug-buffer-name "*lean-server-debug*")
(defvar-local lean-server-option            "--server")
(defvar-local lean-server-debug-mode        t)

;; Log Function
;; ============
(defun lean-server-log (format-string &rest args)
  "Display a message at the bottom of the *lean-server* buffer."
  (with-current-buffer (lean-server-get-buffer)
    (goto-char (point-max))
    (insert (apply 'format (concat format-string "\n") args))))

;; Trace Function
;; ============
(defun lean-server-trace (format-string &rest args)
  "Display a message at the bottom of the *lean-server* buffer."
  (with-current-buffer
      (get-buffer-create lean-server-trace-buffer-name)
    (goto-char (point-max))
    (when lean-global-server-last-time-sent
      (let ((time-diff (- (float-time) lean-global-server-last-time-sent)))
        (insert (format "SLEEP %i\n" (* 1000 time-diff)))))
    (setq lean-global-server-last-time-sent (float-time))
    (insert (apply 'format format-string args))))

(defun lean-server-debug (format-string &rest args)
  "Display a message at the bottom of the *lean-server-debug* buffer."
  (when lean-server-debug-mode
    (with-current-buffer
        (get-buffer-create lean-server-debug-buffer-name)
      (save-selected-window
        (ignore-errors
         (select-window (get-buffer-window lean-server-debug-buffer-name t)))
        (goto-char (point-max))
        (insert (format-time-string "%H:%M:%S:%3N -- " (current-time)))
        (insert (apply 'format (concat format-string "\n") args))))))

;; How to read data from an async process
;; ======================================

  (lean-server-send-cmd-async (lean-cmd-valid) 'message))

(defun lean-server-set-timer-for-event-handler ()
  (lean-server-debug "set-timer-for-event-handler")
  (unless lean-global-retry-timer
    (setq lean-global-retry-timer
          (run-with-idle-timer
