ivaneye.com

Luminus手册-日志

Logging

Luminus模板中包括TimbreRotor

日志通过在handler/init函数中进行如下的设置进行初始化:

  (timbre/set-config!
    [:appenders :rotor]
    {:min-level :info
     :enabled? true
     :async? false ; should be always false for rotor
     :max-message-per-msecs nil
     :fn rotor/append})
  (timbre/set-config!
    [:shared-appender-config :rotor]
    {:path ".log" :max-size 10000 :backlog 10})

Timbre可以记录Clojure的所有日志.

(ns example
 (:use [taoensso.timbre :only [trace debug info warn error fatal]]))
(info "Hello")
=>2012-Dec-24 09:03:09 -0500 Helios.local INFO [timbretest] - Hello
(info {:user {:id "Anonymous"}})
=>2012-Dec-24 09:02:44 -0500 Helios.local INFO [timbretest] - {:user {:id "Anonymous"}}

更多信息请见Github