ceylon / ceylon-common

DEPRECATED
Apache License 2.0
14 stars 9 forks source link

tools: Injecting standard streams #26

Open tombentley opened 11 years ago

tombentley commented 11 years ago

The tools framework currently doesn't do anything special for the standard streams (stdout, stderr & stdin): If a tool wants to print to standard output or error it just uses System.out.println()/System.err.println(). I'm wondering if we should change this. If the top level tool was responsible for injecting the PrintStreams (and InputStream in the case of standard input) it would:

It would mean that tools would need to use the injected streams instead of reaching immediately for System.*.

The other way of looking at this is that tools "shouldn't" be reaching for raw streams at all, but should be using logging. In which case this becomes a question about whether it is the top level tool's job to configure logging, or the individual tools', or some combination.

quintesse commented 11 years ago

To me personally logging should not be used for "proper output", ie useful output that is part of the software's operation. I say this because it's normally possible to affect logging output from outside of the program and I don't think we want that.

So I would just go with your first option. (if my opinion means anything hehe)