Skip to content
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

Open
lihaoyi opened this issue Sep 26, 2024 · 1 comment
Open

Re-design Logger hierarchy #3603

lihaoyi opened this issue Sep 26, 2024 · 1 comment
Milestone

Comments

@lihaoyi
Copy link
Member

lihaoyi commented Sep 26, 2024

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 a Task 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-live

The 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 then logger.info uses it for normal-important things. And how should a user decide between info and just println? When should subclasses of Logger put logic into overriding info vs injecting logic into stdout/stderr streams?

Arguably, all the concrete FooLogger classes should be private[mill], since there's no reason that a Mill user would need to instantiate their own PrintLogger or whatever.

This would break bincompat and would have to go into 0.13.0

@lihaoyi lihaoyi added this to the 0.13.0 milestone Sep 26, 2024
@lihaoyi
Copy link
Member Author

lihaoyi commented Sep 26, 2024

At time of writing this is the current logging hierarchy that is typically available inside any Mill task:

MultiLogger(
    PrefixLogger(
        PrefixLogger(
            PromptLogger("foo.test"),
            "",
            ""
        ),
        "[106] ",
        ""
    ),
    FileLogger(/Users/lihaoyi/Github/mill/example/scalalib/testing/4-test-sharding/out/foo/test/test.log)
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant