Skip to content

Conversation

@kblaschke
Copy link
Member

@kblaschke kblaschke commented Dec 5, 2025

Adding two new API calls to set a logging callback and the log level (AKA verbosity).

The logging callback will be set for all projectM instances within an application, so it can also log initialization errors which were previously impossible to get or log from the outside.

Callback and log level can be set globally (for all threads) or just a specific thread. In case both a thread-specific and global callback or log level has been set, the thread-specific one takes precedence.

Log levels TRACE and DEBUG only have an effect in Debug builds. If the developer sets the new CMake argument ENABLE_VERBOSE_LOGGING to a true value, any Release builds will also produce output on those log levels, at the potential cost of some performance.

All existing output and error messages produced in libprojectM have been converted to use the Logging API, including the error messages produced by HLSLParser, which were previously only written to STDOUT.

I've also moved the GLSL version check from the static shader class to the top of the class ProjectM constructor. This will now check the available GLSL first and produce a FATAL error in the logging output if the version is missing or too low. Since the GLSL language is most indicative of a "good" GL context being available, no further checks are currently being performed (e.g. checking the actual GL version itself).

Please comment if you're missing something with the logging API itself.
With the API now in place, additional log output will be added piece by piece as needed.

Closes #732

@kblaschke kblaschke added this to the 4.2 milestone Dec 5, 2025
@kblaschke kblaschke self-assigned this Dec 5, 2025
@kblaschke kblaschke added the enhancement The feature is considered an enhancement. label Dec 5, 2025
@kblaschke kblaschke moved this from Done to In Review in libprojectM Release 4.2 Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement The feature is considered an enhancement.

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add an error reporting and general logging API

2 participants