标签: timbre

Clojure - 配置`timbre`日志记录

我使用了编写单元测试clojure.test,现在我正在为我的应用程序添加基准测试,使用criteriumperforate.

这很好用,但我有一个问题:我在基准测试中看到了很多日志.我正在使用timbre,我不知道如何从Leiningen的Clojure代码配置它.

我没有设置配置图,虽然它在自述文件中声称非常简单,但我没有找到其他文档,到目前为止我对默认设置很满意.

如何配置timbre登录到具有之间不同的配置文件development,production以及benchmarks(这是子情况下development).

注意:如果这是相关的,我已经在Leiningen 使用了一个productiondevelopment配置文件.

logging clojure timbre

7
推荐指数
1
解决办法
3130
查看次数

音色`set-config!` 已经改变了 arity,因此不知道如何使用它来将 std err/out 输出到文件

我正在尝试使用https://github.com/ptaoussanis/timbre登录到文件而不是控制台。这是我找到的一些有关如何执行此操作的文档:

; The default setup is simple console logging.  We with to turn off console logging and
; turn on file logging to our chosen filename.
(timbre/set-config! [:appenders :standard-out   :enabled?] false)
(timbre/set-config! [:appenders :spit           :enabled?] true)
(timbre/set-config! [:shared-appender-config :spit-filename] log-file-name)
(timbre/set-config! [:shared-appender-config :spit-filename] log-file-name)
Run Code Online (Sandbox Code Playgroud)

这适用于先前版本的 sente,但不适用于版本 [com.taoensso/timbre "4.3.1"]。(由于无关的原因,我需要使用最新的)。上面代码的问题是set-config!现在需要一个参数 - 一个哈希映射。而且我找不到任何文档可以帮助我将上述“两个参数”代码转换为新的“一个参数”代码。

我知道有一个非常类似的问题了那里。这个问题有实际的代码,所以更具体。我也提出了一个问题。上面的代码基本上直接来自here

clojure timbre

5
推荐指数
1
解决办法
530
查看次数

Timbre(Clojure),需要一分钟才能完成

当我运行以下简单程序时,打印"信息后"消息后需要一分钟直到完成.

$ lein run -m logger.core

(ns logger.core
  (:require [taoensso.timbre :as timbre]))

(defn -main []
  (println "before info")
  (timbre/info "hello world")
  (println "after info"))
Run Code Online (Sandbox Code Playgroud)

如果我发表评论(timbre/info "hello world"),那浪费时间就完全消失了.

是什么原因?我怎样才能避免这种情况呢?

提前致谢.

clojure leiningen timbre

2
推荐指数
1
解决办法
238
查看次数

标签 统计

clojure ×3

timbre ×3

leiningen ×1

logging ×1