The issue is not in the code sample you have.
*out*
should refer to clojure.core/*out*
, so if you are running this in a repl you might have run something previous, to what you have, like (def *out* something)
to create a user/*out*
.
Then, when you defined your print-logger
function, the (binding [*out* writer] ...)
statement would be trying to rebind user/*out*
instead of clojure.core/*out*
.
You can use ns-unmap
to remove user/*out*
from your namespace.
(ns-unmap 'user '*out*) ;; => nil
You will also need to define your print-logger
function again to recapture the correct clojure.core/*out*
.