How can you suppress all entries in the Cocoa app?

Is there a way to force suppress all entries on the Mac OS X Cocoa app desktop?

Sometimes some part of the system or a plugin (which is outside your control) will log messages on behalf of your application to the console (system.log).

Is there a way to suppress all entries in your application?

+2


source to share


3 answers


@gabe: just going to suggest something like this - just tried it and a simple "fclose (stderr)" seems to prevent the exit.



+4


source


You can use freopen to change where stdout and sterr point to:



http://www.opengroup.org/onlinepubs/000095399/functions/freopen.html

+4


source


I also did this when I needed to redirect the console output to a custom view:

stderr->_write = RedirectOutputToView;
stdout->_write = RedirectOutputToView;

      

Where RedirectOutputToView has the following prototype:

int RedirectOutputToView(void *inFD, const char *buffer, int size);

      

0


source







All Articles