Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.08 KB

2013-09-28-logging.md

File metadata and controls

46 lines (34 loc) · 1.08 KB
layout title categories tags avatarimg author
post
Luminus手册-日志
luminus
clojure
luminus
/img/head.jpg
wangyifan

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 "{{sanitized}}.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