Spewing stderr to an NSTextView
Spewing stderr to an NSTextView
- Subject: Spewing stderr to an NSTextView
- From: Chris Williams <email@hidden>
- Date: Mon, 12 Nov 2007 15:39:22 -0800
- Thread-topic: Spewing stderr to an NSTextView
This is probably obvious/simple, but it has me baffled. I have an
NSTextView where I want to spew all the stderr output (e.g. NSLog output,
etc. -- imagine the XCode2 run/log window). This would be read-only
(obviously), the only option I'm likely to allow is some combination of
selection and "save to file...". But that's not the question I am working
on.
I have the NSTextView, and I know how to open /dev/stderr as a file, but
where I'm baffled is how to get the latter into the former. :) Do I want to
create a thread that just sits in a loop and waiting on a read from the file
and then dumping that to the NSTextView? Is there a more "cocoa" way to
handle this such as some delegate/method down in NSTextStorage or something
that I'm overlooking? Suggestions/advice?
I thought about writing my own version of NSLog that simply spews into the
NSTextView, and I could write my NSLogs to that method, but that doesn't
solve the problem. On rare instances, the app gets an exception and gives
meaningful output to stderr. I'd like to catch that too. If someone has
another way to catch this output and toss it in there as well, as opposed to
opening stderr as a file, that would work too. In short, I'm looking for an
exception log -> NSTextView method, and I'm open to all options.
Thanks in advance for any assistance.
_______________________________________________
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