每当我尝试在函数中包含 Timbre p
语句时,都会收到错误:
project.clj
(defproject sketch "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[com.taoensso/timbre "3.1.1"]])
core.clj
(ns user (:require [taoensso.timbre :as timbre]))
(timbre/refer-timbre)
(defn tst [a]
(p :tf (+ a a)))
输出(苹果酒/nrepl)
Unable to resolve symbol: p in this context, compiling:(NO_SOURCE_PATH:2:3)
但是其他音色函数/宏,例如 profile
和 spy
工作正常。
最佳答案
p
分析宏 is not exposed with refer-timbre ,文档似乎已经过时了。
(require
'[taoensso.timbre.profiling :as profiling :refer (pspy pspy* profile defnp)])
如you see here , p
只是 pspy
(defmacro p [id & body] `(pspy ~id ~@body)) ; Alias
所以你可以使用pspy
来代替。
关于clojure - 音色宏 'p' 无法解析,但其他音色宏可以解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22240249/