Change out, err, System/out and System/err to print on sessions in addition to process out.
Automatically changes the root binding of all output channels to print to any active sessions. An active session is one that has sent at least one "eval" op.
We use an eval message, instead of the clone op, because there's no guarantee that the channel that sent the clone message will properly handle output replies.
Change *out*, *err*, System/out and System/err to print on sessions in addition to process out. Automatically changes the root binding of all output channels to print to any active sessions. An active session is one that has sent at least one "eval" op. We use an eval message, instead of the clone op, because there's no guarantee that the channel that sent the clone message will properly handle output replies.
An executor used to run flush on print-stream
instances.
Using a single thread reduces resource usage, and possibly reduces
the interleaving of output from different streams.
The executor service will ensure there is always a thread available,
should a flush throw an exception and kill a thread.
Thread names are generated with id-counter, to make them unique.
An executor used to run flush on `print-stream` instances. Using a single thread reduces resource usage, and possibly reduces the interleaving of output from different streams. The executor service will ensure there is always a thread available, should a flush throw an exception and kill a thread. Thread names are generated with id-counter, to make them unique.
(forking-printer messages type)
Returns a PrintWriter suitable for binding as out or err. All
operations are forwarded to all output bindings in the sessions of
messages
, in addition to the server's usual PrintWriter (saved in
original-output
).
type
is either :out or :err.
Returns a PrintWriter suitable for binding as *out* or *err*. All operations are forwarded to all output bindings in the sessions of `messages`, in addition to the server's usual PrintWriter (saved in `original-output`). `type` is either :out or :err.
Store the values of the original output streams so we can refer to them. Please do not inline; they must not be recomputed at runtime.
Store the values of the original output streams so we can refer to them. Please do not inline; they must not be recomputed at runtime.
(print-stream printer)
Returns a PrintStream suitable for binding as java.lang.System/out or
java.lang.System/err. All operations are forwarded to all output
bindings in the sessions of messages, in addition to the server's
usual PrintWriter (saved in original-output
).
printer
is the printer var, either #'clojure.core/out or
#'clojure.core/err.
Returns a PrintStream suitable for binding as java.lang.System/out or java.lang.System/err. All operations are forwarded to all output bindings in the sessions of messages, in addition to the server's usual PrintWriter (saved in `original-output`). `printer` is the printer var, either #'clojure.core/*out* or #'clojure.core/*err*.
(subscribe-session {:keys [session] :as msg})
Add msg to tracked-sessions-map
.
Add msg to `tracked-sessions-map`.
Map from session ids to eval *msg*
s.
Only the most recent message from each session is stored.
Map from session ids to eval `*msg*`s. Only the most recent message from each session is stored.
(unsubscribe-session session)
Remove session from tracked-sessions-map
.
Remove session from `tracked-sessions-map`.
(with-out-binding [v msg-seq type] & body)
Run body with v bound to the output stream of each msg in msg-seq. type is either :out or :err.
Run body with v bound to the output stream of each msg in msg-seq. type is either :out or :err.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close