venantius / ultra

A Leiningen plugin for a superior development environment
Eclipse Public License 1.0
1.24k stars 35 forks source link

log/info is not pretty printed #68

Closed priyatam closed 6 years ago

priyatam commented 7 years ago

I start a repl on the console and connect to it from emacs. While the repl on the console outputs pretty-printed, ultra-enabled formatted, any standard log/info is still output as plaintext on the console.

This should be set by default, or provided as a config option, given that ultra wraps the underlying whidbey.

venantius commented 7 years ago

Hmmm.

On the one hand, I agree with you. It would be nice to use Ultra as source of configuration for logging colorization and configuration. On the other, it's complicated - both in terms of the implementation details and preferred library patterns.

Implementation detail-wise, we don't necessarily know if inheriting applications or libraries will be using, for instance, log4j or logback. log4j in particular really wants to find a file in resources or src to inherit from - we could try to get around this by using clojure.tools.logging to configure things, but then there's a mess in terms of actually passing that configuration over from the Leiningen runtime to the actual application runtime.

Preference-wise, most people in both the Clojure and Java communities seem to prefer lower-level libraries and plugins not do logging configuration - in particular because the actual runtime configuration can become non-deterministic.


That's not to say that I would be opposed to a PR taking a stab at adding this, but I'd want to make sure both that it was configurable and optional, and that it worked under most major logging frameworks.

priyatam commented 7 years ago

I would be open to implementing this PR. The last I checked puget—the underlying library you use, has a simple pprint interface and extending clojure logging's slf4j factory's write method to use puget's wrapper, in theory, might work. But I agree with you, the mismatch between logging configurations continue to baffle us.

And ultra can solve that mess, as it has done for pretty printing on console :)

venantius commented 6 years ago

I'm going to close this issue as lacking follow-up.

I've also thought about it some more and I don't think this is a good fit for Ultra. Ultra aims to be a good general-purpose repl/dev environment utility, whereas logging is a bit more narrowly scoped. That's not to say that I don't think such work would be valuable, just that I don't think it belongs in Ultra.