winit icon indicating copy to clipboard operation
winit copied to clipboard

Logging

Open francesca64 opened this issue 6 years ago • 7 comments

Having proper logging would make things easier for everyone, and I assume most people would agree with that. Telling someone to rerun with WINIT_LOG_LEVEL=debug is much better than saying "rebuild against this branch I made that has some println added that are hopefully relevant", which is something I've had to do a few times now.

Is slog the best way to go about adding logging? I'm also in favor of making the sink global, since passing it around would make this much more tedious to implement.

francesca64 avatar May 25 '18 16:05 francesca64

I would be interested in seeing the standard logging facade used in winit. This would allow debugging with whatever logging backend an application provides rather than requiring a special environment variable.

jwilm avatar May 25 '18 16:05 jwilm

One other thought -- if there is a concern about having logging in hot code paths, winit could potentially add a feature flag to compile out such macro invocations.

jwilm avatar May 30 '18 01:05 jwilm

Sounds good to me. With just using log, this is going to be quite easy, so I'll probably start adding some stuff next time I want something relaxing to work on.

francesca64 avatar Jun 03 '18 03:06 francesca64

What is actually needed here? A lot of work has already been done it seems.

Cargo.toml already names log as a dependency and info! is used alongside the other log macros.

There are a few remaining println!s but most are in examples and the few that remain in the code are outcommented.

Should these be removed or switched to info!?

Abendstolz avatar Jun 22 '19 10:06 Abendstolz

I guess this is one of those features you can't ever complete, can you?

Personally, I'd like that whenever we make something, we log it's ptr. For example, something like "X made colormap, got ptr 0xfffwhatever it is".

In fact, maybe something like apitrace, but for xlib/winapi/etc, so we can easily log what winit passed and got back. This, like apitrace, would likely be implemented outside of winit, of course. Pipe dream, I know.

goddessfreya avatar Jun 22 '19 20:06 goddessfreya

I guess this is one of those features you can't ever complete, can you?

Personally, I'd like that whenever we make something, we log it's ptr. For example, something like "X made colormap, got ptr 0xfffwhatever it is".

In fact, maybe something like apitrace, but for xlib/winapi/etc, so we can easily log what winit passed and got back. This, like apitrace, would likely be implemented outside of winit, of course. Pipe dream, I know.

Something similar to setting WAYLAND_DEBUG for Wayland apps?

jgcodes2020 avatar Feb 24 '24 22:02 jgcodes2020

there's x11trace for x11.

kchibisov avatar Feb 25 '24 04:02 kchibisov