Skip to content

Conversation

@hdijkema
Copy link
Contributor

Add functionality to use a custom log handler, which facilitates
the integration of webui in software. Debug logging of webui
can now be integrated in logging systems of software that uses webui.

@AlbertShown AlbertShown marked this pull request as draft October 17, 2025 17:29
@AlbertShown
Copy link
Member

I totally see the point here, but I'm wondering if this is necessary, especially the fact that all other wrappers need to implement this new API and will be available only in debug version of WebUI. In general people does not use debug version except people who actually developing core code like you, so we won't necessarily need this logging API to debug WebUI core code.

Please let me know if I miss something.

@hdijkema
Copy link
Contributor Author

Well, I've been debugging quite a lot to see what's going on and why some events work and some not in what circumstances. This is while working on a Web application. E.g., why don't I get a 'move' event, or how is it possible I don't get a navigation event. Or why does GtkWebView crash? Or to understand why things "lock up". Without the debug information that's a stretch to do.

Look e.g. at programs like rsync, openvpn, etc. they all have a flexible logging system with more or less detailed information about what's going on under the hood. It's a good practice, especially to understand the behaviour of the software.

In larger software projects people tend to create some logging functionality, e.g. Log4j, log4c. Also lots of programs log to syslog, or trace to a file. Of course one could redirect stdout and stderr to a file, but this is not always easy to do. E.g. my IDE catches stderr/out and the library output (of webui) just "disappears".

I think this code is not intrusive, i.e. when no log handler is installed, it will just log to stdout/stderr. And when one chooses to install a log handler, it will redirect logging to the handler. Even if someone chooses not to implement the call to the log handler installer for a wrapper, it's not really a problem. But someone might choose to implement it, because of the reasons above.

In the end, it's your project, so the decision is yours to make.

@AlbertShown AlbertShown marked this pull request as ready for review October 17, 2025 20:51
@AlbertShown
Copy link
Member

Fair enough @hdijkema, I was just trying to make minimal change as possible in webui.h cause that force lot of other wrappers to be updated as well. I think this PR now have some code conflicts needs to be solved first.

@hdijkema
Copy link
Contributor Author

Ai. I'll try to resolve the conflicts, otherwise all discard this pull request and make another.

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

Successfully merging this pull request may close these issues.

2 participants