> thanks for the hint. I looked into clojure.core and similar files,
> and didnt find much use of *err*.
>
There are a few in clojure.contrib. Have a look at logging.clj,
repl_ln.clj, server_socket.clj, internal.clj and utilities.clj.
(doc *in*)
-------------------------
clojure.core/*in*
A java.io.Reader object representing standard input for read operations.
Defaults to System/in, wrapped in a LineNumberingPushbackReader
(doc *out*)
-------------------------
clojure.core/*out*
A java.io.Writer object representing standard output for print operations.
Defaults to System/out
(doc *err*)
-------------------------
clojure.core/*err*
A java.io.Writer object representing standard error for print operations.
Defaults to System/err, wrapped in a PrintWriter
Basically, by convention when a library function encounters an error
it will write error messages to the default error stream, i.e
System/err (which is normally just the console), but if you wanted to
"capture" that output and write it to a file say, then you could
rebind *err* to your own Writer before calling the library routine,
e.g
(with-open [wtr (java.io.PrintWriter.
(java.io.FileOutputStream.
(java.io.File. "test.errors")))]
(binding [*err* wtr]
; here you call the library, but I'll just...
(.println *err* "foo-error")))
Then test.errors would contain
foo-error
Hth.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en