loggingclojuretimbre

log with timbre in clojure: how to set timestamp and local?


I have the following code.

   (timbre/merge-config! {:timestamp-pattern "yyyy/MM/dd HH:mm:ss ZZ" } )
 (info (str "acm template deploy start..., the version is " version))

But the timestamp format is not I want. How should I set the format?

 $ lein run
Compiling com.rockiedata.dw.acm.template.deploy
15-Jun-25 22:13:00 UnknownHost INFO [com.rockiedata.dw.acm.template.deploy] - acm template deploy start..., the version is 0.1

And also how to set local, in the document it said

  :timestamp-locale  nil

But how to set a Chinese local?


Solution

  • Based on the documentation https://github.com/ptaoussanis/timbre you should do following :

    (timbre/merge-config! 
      {:timestamp-opts 
        {:pattern "yyyy/MM/dd HH:mm:ss ZZ" 
         :locale (java.util.Locale. "zh_CN")}})