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

Add a way to capture error messages. #82

Open
SpaceManiac opened this issue May 22, 2015 · 3 comments
Open

Add a way to capture error messages. #82

SpaceManiac opened this issue May 22, 2015 · 3 comments
Labels

Comments

@SpaceManiac
Copy link

For languages with error handling facilities, it would be useful to be able to capture messages output to sf::err() from CSFML. I suggest an API like:

sfErrorCapture* sfErrorCapture_start();
const char* sfErrorCapture_get(const sfErrorCapture* capture);
void sfErrorCapture_end(sfErrorCapture* capture);

I tried to implement this myself using std::ostringstream, but it seems like something is going odd in linking and each CSFML module has its own copy of the sf::err function, so placing these functions in the system module means that errors from other modules are not redirected.

@oprypin
Copy link
Member

oprypin commented Aug 23, 2015

I support this.

@LaurentGomila
Copy link
Member

Error handling will completely change in a future version of SFML, and as you pointed, there are multiple sf::err streams in CSFML, so there's no easy solution.

@zsbzsb
Copy link
Member

zsbzsb commented Nov 6, 2015

It would be possible to add a function to each module to redirect the output into a single stream. Trouble with that approach is that if SFML is dynamically linked then sf::err will be set multiple times and it would be redundant. But that could be avoided with a few simple processor commands at compile time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants