Redirecting NSLog ?

How to redirect NSLog output to any of my file (or elsewhere) ?
First, what does NSLog ?
The documentation says:
NSLogv writes the log to STDERR_FILENO if the file descriptor is open. If that write attempt fails, the message is sent to the syslog subsystem, if it exists on a platform, with the LOG_USER facility (or default facility if LOG_USER does not exist), with priority LOG_ERR (or similar). If both of these attempts to write the message fail, the message is discarded.

That information is enough to see that a simple
freopen on stderr is enough to redirect the output of NSLog to any file:
FILE *myStderr = freopen("my_stderr_output","w", stderr):.

If you prefer to redirect the output in another, you can do the following:
stderr->_write = stderrwrite ;
with
stderrwrite having the following prototype:
int stderrwrite(void *inFD, const char *buffer, int size)
From there, you can do anything you like,
inserting the message in a
NSTextView...