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

Summary: SDL_LogSetOutputFunction(...) should revert to default output function
Product: SDL Reporter: george.oros
Component: *don't know*Assignee: Sam Lantinga <slouken>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: 2.0.5   
Hardware: All   
OS: All   

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!