     (logoverlay-update-overlays)
     ))
 
+(defun logoverlay--refresh-overlays ()
+  (if logoverlay--showing-overlays
+      (progn
+        (logoverlay-toggle-overlays)
+        (logoverlay-toggle-overlays))))
+
+(defvar logoverlay--monitor-attributes nil
+  "Cached file attributes to be monitored.")
+
+(defun logoverlay--install-monitor (file secs fn)
+  (run-with-timer
+   0 secs
+   (lambda (f p fn)
+     (let ((att (file-attributes f)))
+       (unless (or (null logoverlay--monitor-attributes) (equalp logoverlay--monitor-attributes att))
+         (funcall fn))
+       (setq logoverlay--monitor-attributes att)))
+   file secs fn))
+
+(defun logoverlay--log-changed ()
+  (logoverlay--refresh-overlays)
+  )
+
+(defvar logoverlay--monitor-timer nil
+  "Check if /tmp is changed every 5s.")
 
 (provide 'logoverlay)
+
+

(defun logoverlay--make-log-overlay (bounds)
  (let ((entries (logoverlay--get-log-entries-by-file-and-id (buffer-file-name)
                                                             (cdr (assoc 'id bounds)))))
    (message "entries: %s" entries)
    (mapcar (lambda (log)
              (let ((value (json-encode (cdr (assoc 'value log))))
                    (overlay (make-overlay (cdr (assoc 'start bounds))

                (push overlay logoverlay--logged-overlays)
                (overlay-put overlay 'face '(underline . green))
                (overlay-put overlay 'help-echo value)
                (overlay-put overlay 'after-string (concat "\n -> " value))))
            entries)))

(defun logoverlay--find-logs ()
