[英]Output compojure server print statements into figwheel terminal?
Where does pprint
/ println
output go in compojure?/Can I get it to show up in the terminal window that the figwheel repl is running in? pprint
/ println
输出进入compojure的什么地方?/我可以在运行figwheel repl的终端窗口中显示它吗? (Sorry if this sounds dumb, google bested my efforts). (抱歉,这听起来很愚蠢,Google竭尽全力)。
Actually Figwheel has a related feature to cause such symptoms. 实际上,Figwheel具有导致此类症状的相关功能。 All print/prn statements in your ring handlers will be "swallowed" by the Figwheel process and will either go to a log file or to the console. 环形处理程序中的所有print / prn语句将被Figwheel进程“吞噬”,并进入日志文件或控制台。
Here is a snippet from project.clj: 这是project.clj的片段:
:figwheel
{:http-server-root "public"
:server-port 3449
:nrepl-port 7002
:css-dirs ["resources/public/css"]
:ring-handler myapp.handler/app
:server-logfile false
}
The key :server-logfile is controlling this behavior. 关键:server-logfile正在控制此行为。 If it's false, then out is your regular repl console, if it's a filename, then anything printed will go to that file (if it's not present, then the default is using file "figwheel_server.log". 如果是假的,那么出来是你的常规REPL控制台,如果它是一个文件名,然后打印任何东西会去到该文件(如果它不存在,则默认使用文件“figwheel_server.log”。
Figwheel issue: https://github.com/bhauman/lein-figwheel/issues/436 Figwheel commit: https://github.com/bhauman/lein-figwheel/commit/330d8d7fda8be145615910cf639bd9a3242339ba Figwheel问题: https : //github.com/bhauman/lein-figwheel/issues/436 Figwheel提交: https : //github.com/bhauman/lein-figwheel/commit/330d8d7fda8be145615910cf639bd9a3242339ba
It seems to show up there without any special setup... I get this at the console: 似乎没有任何特殊设置就可以显示出来。
Prompt will show when Figwheel connects to your application
"I got a request"
Triggering the handler: 触发处理程序:
curl localhost:3449/foo
src/with_server/server.clj src / with_server / server.clj
(ns with-server.server)
(defn handler [req]
(prn "I got a request")
{})
In project.clj under :figwheel {} 在project.clj中的:figwheel {}下
:ring-handler with-server.server/handler
If you are having trouble, maybe you need ring-reload middleware so that the changes you are making get reloaded? 如果遇到问题,也许您需要环网重新加载中间件,以便重新加载所做的更改?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.