Page 1 of 1

NSLog?

Posted: Mon Jan 17, 2011 8:04 pm
by colinh
NSLog doesn't work the way it should.

That may have something to do with the OOLog* stuff.

However, that's about 2.3 THOUSAND lines of code, which I don't really want to go through! I just want to use NSLog.

I saw some #undef NSLog code, but when I try that I get no output either.

*grump*

Re: NSLog?

Posted: Mon Jan 17, 2011 8:37 pm
by another_commander
colinh wrote:
NSLog doesn't work the way it should.

That may have something to do with the OOLog* stuff.

However, that's about 2.3 THOUSAND lines of code, which I don't really want to go through! I just want to use NSLog.

I saw some #undef NSLog code, but when I try that I get no output either.

*grump*
I am not working on a Mac, but although I don't see why NSLog() would fail, maybe you can use OOLog() for what you need to do? OOLog works in a similar way to NSLog, only instead of [b]NSLog(@"This is a message");[/b] you would use [b]OOLog(@"LogClassOfMyMessage", @"This is a message");[/b].

Re: NSLog?

Posted: Mon Jan 17, 2011 8:47 pm
by JensAyton
NSLogs will turn up in the log as “[unclassified]” messages if you’ve included OOLogging.h, and “[system]” messages if you call the real NSLog. (In GNUstep builds, real NSLog calls are labelled “[gnustep]”.)

I suspect that what you really want is to see log messages in the Xcode console, which you can get with defaults write org.aegidian.oolite [url=http://wiki.alioth.net/index.php/Hidden_Settings_in_Oolite]logging-echo-to-stderr[/url] -bool true in the terminal. (Or select “Echo log to stderr” in Secrets.prefpane.)

Re: NSLog?

Posted: Tue Jan 18, 2011 1:06 pm
by colinh
I suspect that what you really want is to see log messages in the Xcode console
Yes, thanks, that's what I wanted.


And thanks for the link to the Secret Hidden Settings page!

I hadn't even found/looked for the Elite Wiki :-)

Just out of interest, is the Hidden Settings Page linked to from the Oolite Main Page? I didn't see it offhand :-) But then, it wouldn't be much of a hidden secret hidden settings page, if it were... :mrgreen:


Key: logging-echo-to-stderr
Type: boolean
Default: NO
If set to YES, log messages are written to the standard error output as well as the log file.

NSLogs will turn up in the log as “[unclassified]” messages if you’ve included OOLogging.h, and “[system]” messages if you call the real NSLog.
I know it must look like I'm being deliberately thick/lazy, (it's always like that when getting into a new project :-( ) but, where is this log file? I've looked in ~, /, /var/log/, ~/Documents, ~/oolite-saves and a bit in ~/developer/oolite/ and /opt/var/local...

Re: NSLog?

Posted: Tue Jan 18, 2011 2:43 pm
by JensAyton
colinh wrote:
I know it must look like I'm being deliberately thick/lazy, (it's always like that when getting into a new project :-( ) but, where is this log file? I've looked in ~, /, /var/log/, ~/Documents, ~/oolite-saves and a bit in ~/developer/oolite/ and /opt/var/local...
~/Library/Logs/Oolite/Latest.log. Or Show Log in the debug menu. :-)

Re: NSLog?

Posted: Tue Jan 18, 2011 5:41 pm
by Commander McLane
colinh wrote:
Just out of interest, is the Hidden Settings Page linked to from the Oolite Main Page? I didn't see it offhand :-)
You could try the link to Hidden Settings in Oolite from the Oolite Main Index. :wink: