 (def ids (atom 0))
 (def pending-logs (a/chan))
 
-(declare reape-log)
+(declare collect-log)
 
 (defn prepare-backup-server [data-path]
   (reset! data-path (str data-path "/" start-time "/"))
-  (a/go-loop [] (apply reape-log (a/<! pending-logs))))
+  (a/go-loop [] (apply collect-log (a/<! pending-logs))))
 
 (defn convert-server-name-for-file [^String str] (.replace str ":" "-"))
 

            ^OutputStream new-appender (io/output-stream (str base-path trunk-id "-" timestamp ".mlog"))]
        (reset! (get-in client [:appenders trunk-id]) new-appender)
        ;close orignal appender
        (a/>! pending-logs [appender -1 timestamp nil]))
      (finally
        (.unlock log-switch)))))


  (.flush appender)
  (.close appender))

(defn collect-log [^OutputStream appender act timestamp ^UUID cell-id & [data]]
  (if (= -10 act)
    (close-appender appender)
    (l/append appender act timestamp cell-id data)))