What should Mill's logging framework do? #4680
Replies: 2 comments
-
I have one use case that I can share. Sometimes, working with legacy codebases updated to newer Scala versions, you get thousands of warnings. When you have one error and 1000 warnings it's hard to read the error from the command line. |
Beta Was this translation helpful? Give feedback.
-
I think we want to separate two things here:
Where is the distinction? LoggingLogging is everything you might need once you need to debug some code. It can become pretty verbose and might need to contain data that nobody wants to see on the cli. Hence we typically log into a file. Depending on the use-case we log to a server. And to avoid any kind of log injection or to be able to further process logs, we want to log as JSON. Since this is all pretty standard tooling, we should use standard tooling for it. The Standard API of Once we properly setup a the logging API, we also benefit for it being a standard and will collect all the log messages of the used libraries in our log file, which can help to better understand what's going on. Since we do a lot of classloaders, we need to find out some way, to collect those log messages too. Maybe it's enough to load the log API from the parent classloader. Build OutputThis is the output meant to be visible on the CLI. Message are typically printed into context, so no timestamps, log levels, stack traces or other stuff is really needed. It should be stable and pregnant. This is, what we have our current I still think we should have configurable colors, and it's on my TO-DO list for this year, if nobody else tackles it. I need to run Mill in a light console, since when I use a dark one, which I would prefer, I can't read the dark blue output which we use for progress-count and info messages. |
Beta Was this translation helpful? Give feedback.
-
Opening this as a follow up from #3603, so we can have a place for continued discussion not limited to the original cleanup. The basic question is: various logging frameworks have a range of different features, which features should we copy in Mill's logging API?
@lolgab already mentioned filtering by log levels. We basically have a rudimentary version of that via
--debug
, but filtering by other log levels makes sense too?Should there be a
TRACE
level separate fromERROR
? Or user configurable log levels?Should we have special handling for JSON logging or other structured logs?
Should log lines have timestamps? On one hand it's convenient when looking at historical logs, on the other hand it's super verbose and irrelevant in environments where timestamps are available separately (e.g. iTerm lets you pull up timestamps on the right for any console output, some CI systems automatically make timestamps available for any stored logs)
Should log lines automatically capture file/class names and line numbers like
pprint.log
does?Should colors be configurable, as discussed on Configurable colors #471 from @lefou?
Are there any other things that logging frameworks do that Mill is missing? And perhaps at a high level, how do we make a decision about what logging features Mill should or shouldn't support?
Beta Was this translation helpful? Give feedback.
All reactions