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

Increase default log level if DEBUG_INVOCATION=1? #12275

Open
smcv opened this issue Feb 12, 2025 · 2 comments
Open

Increase default log level if DEBUG_INVOCATION=1? #12275

smcv opened this issue Feb 12, 2025 · 2 comments

Comments

@smcv
Copy link
Contributor

smcv commented Feb 12, 2025

Since systemd 257, if a systemd unit fails and is restarted, and it has RestartMode=debug in its configuration, systemd will automatically set DEBUG_INVOCATION=1 for the restarted instance.

Recent GLib detects DEBUG_INVOCATION=1 and automatically turns on debug logging. Steam's pressure-vessel does similarly, even if it happens to have been compiled/linked against older GLib (in practice it usually is).

I realise that it's relatively unlikely for a systemd service to be written using SDL, but perhaps it would be helpful for SDL to do this too, to spread the meme that DEBUG_INVOCATION=1 is a good general-purpose way to say "more information, please"?

I think the ideal handling would be to turn on some reasonable level of debug logging (for example the equivalent of SDL12COMPAT_DEBUG_LOGGING=1 and SDL2COMPAT_DEBUG_LOGGING=1 would probably be appropriate), but try not to increase the log level so much that important information is lost in the noise (so for example logging individual input events would probably be too much).

I don't know what that should mean in SDL-world: perhaps raising the default for everything to DEBUG level? The calls to SDL_LogDebug() within SDL itself don't look too noisy to me, and mostly they seem to be things that would typically happen either once per run (like detecting whether to use udev or inotify for Linux input device enumeration), or only when something "big" happens (like creating a window with Vulkan rendering enabled, or plugging/unplugging a game controller), or only when something unexpected or non-ideal happens (like inability to parse various HID reports).

@smcv
Copy link
Contributor Author

smcv commented Feb 12, 2025

For VERBOSE I can't tell what the intention is, because SDL doesn't use it.

TRACE seems to be used for individual macOS, Wayland and Windows events, which I think is too much in this context.

@slouken
Copy link
Collaborator

slouken commented Feb 13, 2025

This seems reasonable, SDL_HINT_LOGGING is currently documented like this:

 * If this hint isn't set, the default log levels are equivalent to:
 *
 * `app=info,assert=warn,test=verbose,*=error`

That could change to:

 * If this hint isn't set, the default log levels are equivalent to:
 *
 * `app=info,assert=warn,test=verbose,*=error`
 *
 * If the `DEBUG_INVOCATION` environment variable is set to "1", the default log levels are equivalent to:
 *
 * `assert=warn,test=verbose,*=debug`

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

2 participants