List compojure print servers for printing in the terminal terminal?

Where pprint output of pprint / println go to compojure? / Can I make it appear in the terminal window where figwheel is running? (Sorry if this sounds silly, google has exceeded my efforts).

0
source share
2 answers

In fact, Figwheel has a related function that causes such symptoms. All print / prn instructions in your call handlers will be swallowed by the Figwheel process and will either go to the log file or to the console.

Here is a snippet from 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 } 

Key: server-logfile controls this behavior. If it is erroneous, then you are your regular repl console, if it is a file name, then something printed will be sent to this file (if it is not present, then the default file is figwheel_server.log.

Wheel problem: https://github.com/bhauman/lein-figwheel/issues/436 The figure commits: https://github.com/bhauman/lein-figwheel/commit/330d8d7fda8be145615910cf639bd9a3242339ba

+1
source

It seems to appear there without any special setup ... I get this on the console:

 Prompt will show when Figwheel connects to your application "I got a request" 

Handler launch:

 curl localhost:3449/foo 

CSI / with_server / server.clj

 (ns with-server.server) (defn handler [req] (prn "I got a request") {}) 

In project.clj under: figwheel {}

 :ring-handler with-server.server/handler 

If you are having problems, you may need middleware to reload calls so that the changes you make are reloaded?

+1
source

Source: https://habr.com/ru/post/1206195/


All Articles