@pez I have a question that is not necessarily Calva related, but I only know enough to ask about it in the context of Calva, and I'm wondering if you could help me to understand. I have some code that connects to a socket and prints messages from the socket as they are received. When I am in my code file and I run the Calva command "Load current namespace in REPL terminal," the repl that I have open in the terminal suddenly states something like "nrepl logging initialized" and then calva opens a new repl and switches to my current namespace. So the first repl is still in the user namespace but has the logging enabled statement. In the second repl that Calva opened, I run my code to create the socket connection. To see the messages that are printed, I have to switch back to the first repl where logging is enabled, they do not print in the repl Calva started. I believe this has something to do with my print messages going to the nrepl buffer or something, and the fact that I can see them has something to do with nrepl logging being initialized in the first repl. My questions:
1) What caused this "nrepl logging initialzed" to happen in the first repl? Did Calva do this? I looked in the Calva code but did not see where this might be.
2) If I just manually switch to my namespace in my terminal repl with
in-ns and run my code to create the socket connection, I do not see the print messages. How can I see the print messages without using Calva's "Load current namespace in REPL terminal," which causes nrepl logging to be initialized in one repl (where I can see my print messages) and opens a new repl. Basically, I think I just need to understand where my print messages are going, and how to manually see them.
@brandon.ringe, I think this might be Calva not handling this use case well… Now trying to follow: the repl that prints the message, is that opened by Calva or by you, manually? When Calva connects to the nREPL server it also creates a Terminal REPL session (basically opening a Terminal bash process and doing the nREPL connect thing). This is the REPL that Calva then refers to as the “Terminal REPL” and which will receive the command to load the namespace, when you issue it.
1) I don’t think I have ever seen the “nrepl logging initialized” message, so I can’t really guess what it is about (and, as you’ve already figured out, at least not originating directly from Calva).
2) You could try to run the Evaluate current file command in Calva, instead of loading the namespace in the Terminal REPL. You should see Calva logging this call and any results from it in the Output pane (in the channel Calva says). Then try use any of the Evaluate commands that not ends in “in REPL terminal”, evaluating code in the file and you should see both the results of the evaluation and any output side effects also in the Output pane.
I’ll now be cooking food for my son's birthday, so might be slow to answer. Sorry for the inconvenience!
@pez Yes, the repl that prints the "logging initialized message" and also prints the messages from the socket is the one opened by me. The one opened by Calva is the one I run my code in to create the socket connection. Thanks for the response. I'll try that again once I get home from work later today.
Unfortunately, I don't yet work professionally in Clojure, but that is my goal for the near future. 🙂1🤘