Re: Redirect NSLog to stdout?
Re: Redirect NSLog to stdout?
- Subject: Re: Redirect NSLog to stdout?
- From: Graham Cox <email@hidden>
- Date: Wed, 30 Jun 2010 00:28:05 +1000
On 30/06/2010, at 12:09 AM, Tito Ciuro wrote:
> I have written a small app which gets launched when SuperDuper has finished backing up my data. The problem is that since NSLog() writes to stderr, SuperDuper treats this as an error. The advice I've been given is to redirect NSLog() to stdout. One possible solution I can think of is the following:
>
> void NSLogOut (NSString *someString)
> {
> [someString writeToFile: @"/dev/stdout" atomically: NO];
> }
>
> Then I can call it everywhere like so:
>
> NSLogOut(@"blah");
I'm pretty sure that won't work. Instead, you could look at [NSFileHandle fileHandleWithStandardOutput];
> I don't really like it, since this forces me to use NSLogOut() everywhere... which kinda sucks. Instead, is there a way to configure NSLog() so that it redirects to stdout instead of stderr?
This would be a lot better, but I'm afraid I don't know how to do that.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden