I have a project cite 3rd-party frameworks. in which it use NSLog. I'd like to redirect NSLog to other destination(say Dotzu)
Is it possible to override NSLog in my project?
I have a project cite 3rd-party frameworks. in which it use NSLog. I'd like to redirect NSLog to other destination(say Dotzu)
Is it possible to override NSLog in my project?
You cannot overwrite it, because it is a function, not a method. However, NSLog() additionally writes to stderr under some conditions as stated in the discussion of NSLogv(), which is called by NSLog():
Logs an error message to the Apple System Log facility (see man 3 asl). If the STDERR_FILENO file descriptor has been redirected away from the default or is going to a tty, it will also be written there. If you want to direct output elsewhere, you need to use a custom logging facility.
So simply redirect STDERR_FILENO using freopen().