-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Implement a thread-safe 'sf::Err' #3010
base: master
Are you sure you want to change the base?
Conversation
306bcc3
to
e76be29
Compare
e76be29
to
7632ce2
Compare
I have a number of thoughts on error logging I wanted to share.
Here's what I picture as my ideal solution at this point in time. Opinions prone to change as I think more about this.
In user code: std::ostreamstring errorLog;
sf::setErrorLogBuffer(errorLog.rdbuf());
sf::Texture texture
if (!texture.loadFromFile("path/to/texture.png")) {
std::cerr << errorLog.string(); // "Failed to load image..."
return EXIT_FAILURE;
} In SFML itself: else
{
// Error, failed to load the image
logError("Failed to load image\n{}\nReason: {}", formatDebugPathInfo(filename), stbi_failure_reason());
return false;
} How complicated is existed Scrolling through all uses of I only found one place where |
Alternative design to #3008