How to capture stdout/log output of an agent in SLIME?

1.1k views Asked by At

I send a task to an agent, but can't see the output of any print statements I've put into the function. How do I trace code execution on agents?

EDIT: Turns out I do get the output in the console, but not in SLIME. The question now is, how to see the output in SLIME?

2

There are 2 answers

1
rplevy On BEST ANSWER

The key is to start swank from emacs as the inferior lisp process instead of calling lein swank from the shell. One way to do this is to use elein (the command is M-x elein-swank). Then you can either inspect the output in the inferior lisp buffer (which is called *elein-swank* in the example of using elein), or execute slime-redirect-inferior-output and have the output inline in the repl. Clojure.contrib.logging is a useful tool for sending log output.

0
Arthur Ulfeldt On

You could wrap the calls in your repl in (with-out-str (def result (my-code))) to capture the output as a string. this way you can do it for just the code you're working on and you dont have to restart your repl to start getting your output.