mirror of https://github.com/status-im/timbre.git
Add unit test for 3rd-party rotor appender (@rosejn)
This commit is contained in:
parent
31872bc830
commit
09c0a46881
|
@ -4,8 +4,6 @@
|
|||
[taoensso.timbre :as timbre])
|
||||
(:import [java.io File FilenameFilter]))
|
||||
|
||||
;; TODO Test port to Timbre v4
|
||||
|
||||
(defn- ^FilenameFilter file-filter
|
||||
"Returns a Java FilenameFilter instance which only matches
|
||||
files with the given `basename`."
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
(ns taoensso.timbre.appenders.3rd-party.rotor-test
|
||||
(:require
|
||||
[clojure.test :refer :all]
|
||||
[clojure.java.io :as io]
|
||||
[taoensso.timbre :as timbre]
|
||||
[taoensso.timbre.appenders.3rd-party.rotor :as rotor]))
|
||||
|
||||
(deftest rotor-test
|
||||
[]
|
||||
(let [logfile "rotor-test.log"
|
||||
n-logs 5]
|
||||
(timbre/merge-config!
|
||||
{:appenders {:rotor (rotor/rotor-appender
|
||||
{:path logfile
|
||||
:max-size 200
|
||||
:backlog n-logs})}})
|
||||
(doseq [i (range 100)]
|
||||
(timbre/info "testing..."))
|
||||
|
||||
(let [f (io/file logfile)]
|
||||
(is (.exists f))
|
||||
(.delete f))
|
||||
|
||||
(doseq [i (range 1 (inc n-logs))]
|
||||
(let [f (io/file (str logfile ".00" i))]
|
||||
(is (.exists f))
|
||||
(.delete f)))))
|
||||
|
||||
|
Loading…
Reference in New Issue