We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3666 - SDL_LogSetOutputFunction(...) should revert to default output function
Summary: SDL_LogSetOutputFunction(...) should revert to default output function
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.5
Hardware: All All
: P2 enhancement
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-09 07:17 UTC by george.oros
Modified: 2017-08-11 18:11 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description george.oros 2017-06-09 07:17:44 UTC
Call to function SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata) with parameter callback set to NULL should revert to default output function (e.g. if (callback == NULL)SDL_log_function = SDL_LogOutput;).
Otherwise upon changing the log output function to a custom one, one cannot revert to the default (function SDL_LogOutput is declared static in SDL_log.c).
Comment 1 george.oros 2017-06-09 09:06:31 UTC
In case of forgetting to do first a Get before setting the custom function.
Comment 2 Ryan C. Gordon 2017-06-09 14:28:27 UTC
Right now, callback==NULL doesn't crash when logging, it effectively turns logging off, which could also be desirable. I don't think we specifically documented that effect, though, so we _could_ change this.

Another alternative is to add a SDL_LogGetDefaultOutputFunction() API.

Sam, do you have a preference on this?

--ryan.
Comment 3 george.oros 2017-06-09 16:42:19 UTC
Would be nice to have a consistent approach for all callback function (e.g. SDL_HitTest, and others I don't know of).

Many thanks!