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

Option to disable the location info of a logging message #25106

Closed
KristofferC opened this issue Dec 15, 2017 · 10 comments
Closed

Option to disable the location info of a logging message #25106

KristofferC opened this issue Dec 15, 2017 · 10 comments
Labels
logging The logging framework

Comments

@KristofferC
Copy link
Member

I would argue this is quite rarely wanted. Perhaps it should even be off by default?

Anyway, an option to disable it is probably needed. @c42f

@c42f c42f mentioned this issue Dec 15, 2017
15 tasks
@c42f
Copy link
Member

c42f commented Dec 15, 2017

For sure, options here are good, though not in SimpleLogger - I think a stdlib Logging.ConsoleLogger with the bells and whistles would be the place to add lots of functionality. In fact I'd like to remove even more functionality from Base.CoreLogging.SimpleLogger if possible, and leave it completely bare bones.

My current best try at something readable which also retains metadata is MicroLogging.InteractiveLogger which you can get by just doing using MicroLogging on the MicroLogging master branch. See also the first point in #25109.

The annoying thing about logging metadata is that you don't want to see it most of the time, but when you do want to see it, you really want to see it and you curse yourself for turning it off. Which leads me to think that the logs could be saved with full metadata to a log file, with the ability to replay them for more detail on the console if necessary. But I haven't implemented any of that yet.

Regarding a full logger configuration system - this is something I'm planning to ignore for now in lieu of getting other logging related cleanup done, but is an important part of a complete system.

@KristofferC
Copy link
Member Author

KristofferC commented Dec 15, 2017

So to prevent:

image

I should now not use the logging system at all? That's fine by me since I mostly just want to print a colored message.

@c42f
Copy link
Member

c42f commented Dec 15, 2017

Definitely use the logging system, @info is designed for what you're doing here, and if you can't use it, then this is a failing of the system and should be fixed.

If the default formatting is ugly, well we just need to fix it - which is my point that we should have a nicely formatted ConsoleLogger as the default, rather than SimpleLogger which is what you're currently seeing. The reason that you're seeing SimpleLogger rather than something prettier is that the deprecations to info()/warn() needed to go in before feature freeze.

By the way, I'm expecting to clarify in the documentation that log messages are expected to be markdown formatted, so if you want to provide formatting in the log messages that should be useful. For example, a summary of Pkg3 actions could be provided as a markdown table and ConsoleLogger should be expected to make that pretty.

@c42f
Copy link
Member

c42f commented Dec 15, 2017

To clarify, Logging.ConsoleLogger doesn't yet exist, but it should. It should be the default for the REPL, and it should format things in the most readable way possible.

@nalimilan
Copy link
Member

The formatting looks fine to me, it's just that the line numbers are clearly irrelevant here, we're not debugging anything in this case.

But is it really what logging is designed for? To me, logging is more for messages which either indicate problems, or can be ignored and are just of interest when debugging. The messages we're talking about here are very different, they just indicate progress during normal operation.

@StefanKarpinski
Copy link
Member

I'm not sure that Pkg3 should actually use the logging system for its output. Some high-level info, sure, but a lot of what it outputs is just eye-candy to give the user a good feel for what's going on. Then again, info like "this package was upgraded from this version to this version" are things one might want to log, but I feel like that might want to be a separate log stream that's intended for machine consumption instead of human consumption.

@c42f
Copy link
Member

c42f commented Dec 15, 2017

I thought about this quite a bit as I developed the system, for example inspecting how systems like Pkg2 and Documenter communicate with the user. The conclusion I came to so far is that logging can be a good choice for this kind of progress reporting. In particular

  • Updates come incrementally and represent the state of the program.
  • Some events may have state which would be interesting when debugging, if only it could be captured in something other than text.
  • If someone uses Pkg3 as part of a larger application, they may want to silence the output or only print warnings, etc. They need more than text for this.
  • For people using graphical IDEs, having only plain text to work with is a shame. It would be nice if they could systematically collect and format the output in a way which is more powerful than simple text.

The main difficulty is giving enough formatting control to make the output readable, hence the idea that the message should be interpreted as markdown, and my initial efforts to make formatting not suck by reducing the left hand margin to fixed width and right justifying the metadata.

It's also worth noting that there's a rather big difference between Pkg3 as the application vs Pkg3 as a library. If you're willing to spam stdout, you're thinking of Pkg3 as the main application. When it's a library it should not do so. This is a difficult conundrum, but I think it's solvable: As an application (eg, in Pkg repl mode) it should be free to install a custom Logger which prettifies the log messages. As a library, it should allow the larger application to control the output.

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Dec 15, 2017

Brilliant! I'm completely sold. It will be some work to integrate, but since it "only" affects interactive experience, it seems like fair game to work on post-feature-freeze.

@c42f
Copy link
Member

c42f commented Dec 15, 2017

Perfect! That's my hope regarding feature freeze - that the less "featury" of the changes implied by the logging work could be done in the cleanup period 😊 see #25109.

@c42f
Copy link
Member

c42f commented Jan 12, 2018

Fixed in #25488 / #25370

@c42f c42f closed this as completed Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logging The logging framework
Projects
None yet
Development

No branches or pull requests

4 participants