-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-design Logger
hierarchy
#3603
Comments
At time of writing this is the current logging hierarchy that is typically available inside any Mill task:
|
A step towards #3603. For now just doing relatively shallow cleanups, but hopefully that paves the way to bigger refactorings The main external-facing change is renaming `inStream`/`outputStream`/`errorStream` to `streams.in`/`out`/`err`, though the internal refactorings are more substantial
With #4653 and #4658, most of the superficial cleanups have been done. The next big questions are around the architecture of the logging API What do we want to do with
Different logging libraries have varying degrees of sophistication in how they handle log levels. Currently Mill just stuffs them all into How should Currently the various combinations of
Currently, only three scenarios are actively used and tested
Do we need all 5 options, or would fewer options be sufficient? |
Another part of #3603 More narrowing of the `Logger` interface so we can figure out what really needs to be there - Moved `colored`, `infoColor`, `errorColor` to the `prompt` object since it's not typically overriden - Inlined the `subLogger` calls at its one call-site
Part of #3603 We've been using the new multi-line `PromptLogger` for a while since 0.12.0 was released back in Aug 2024, and it's worked great. So we can remove the old implementation for 0.13.0 due in mid 2025, and deprecate and hide the `--remove-prompt` flag that was introduced to flip back to the old implementation. It turns out that we were still using the old `PrintLogger` in a bunch of places - unit tests, testrunner, etc. - and I had to replace those use sites either with `PromptLogger` or with just `println` Also made some adjustments to `enableTicker` handling to keep it internal within `Logger` so it is more consistently applied, and fixed the logging of skipped tasks in `--keep-going`
Part of #3603 Mostly just describing what they do now
Going to call this done. The design can always be better, and we can continue improving it, but I think this meets the minimum threshold of quality and tidyness for now |
I would love to be able to set a global level as I can do with sbt. |
I'm not a sbt user. Can you explain, how that would look like for Mill?
Yeah, I'd love to have that, too. |
@lihaoyi I can start by opening a PR to add |
The
Logger
interface is a bit of a mess, doing a bunch of different things some Mill-internal and some user-facing. #3577 extends it a bit but makes it even more messy.Probably we should have more narrow specialized
Logger
interfaces for different parts of the codebase, e.g. the logger inside aTask
would have a ticker, whereas the logger outside would not, and a top-level logger would have more power to do things like configuring the prompt that task-specific loggers would not have.close()
probably needs to be re-thought since the lifecycle of the various loggers is all different, with some short-lived and some long-liveThe whole color scheme and debug/info/warning/error conventions also need to be redone. Currently
infoColor
is blue and normally used for "less important" things, but thenlogger.info
uses it for normal-important things. And how should a user decide betweeninfo
and justprintln
? When should subclasses ofLogger
put logic into overridinginfo
vs injecting logic into stdout/stderr streams?Arguably, all the concrete
FooLogger
classes should beprivate[mill]
, since there's no reason that a Mill user would need to instantiate their ownPrintLogger
or whatever.This would break bincompat and would have to go into 0.13.0
The text was updated successfully, but these errors were encountered: