<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Filename and Line Number with NSLog: Part II</title>
	<atom:link href="http://iPhoneDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html/feed" rel="self" type="application/rss+xml" />
	<link>http://iPhoneDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html</link>
	<description>Tips and Tricks for iPhone developers</description>
	<lastBuildDate>Fri, 12 Mar 2010 10:03:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Arne</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html/comment-page-1#comment-9206</link>
		<dc:creator>Arne</dc:creator>
		<pubDate>Sat, 30 Jan 2010 23:53:45 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=225#comment-9206</guid>
		<description>thanks a lot, it&#039;s a really useful class :)</description>
		<content:encoded><![CDATA[<p>thanks a lot, it&#8217;s a really useful class :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darkroom</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html/comment-page-1#comment-9151</link>
		<dc:creator>Darkroom</dc:creator>
		<pubDate>Thu, 28 Jan 2010 18:18:10 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=225#comment-9151</guid>
		<description>Alternatively, simply toss the following into AppName_Prefix.pch file and don&#039;t worry about setting preprocessor macro flags in the target build (as some tutorials are suggesting).  it&#039;s the same output as NSLog, but that&#039;s the trade off for not having to write and manage a new class/singleton.

----------------------------------------
//Toggle DebugLog() Visibility
#define ShowDebugLogs 0 

//DebugLog() Visibility
#if ShowDebugLogs
	#define DebugLog(...) NSLog(__VA_ARGS__)
	#else
	#define DebugLog(...)
#endif

//ReleaseLog() Visibility
#define ReleaseLog(...) NSLog(__VA_ARGS__)
----------------------------------------</description>
		<content:encoded><![CDATA[<p>Alternatively, simply toss the following into AppName_Prefix.pch file and don&#8217;t worry about setting preprocessor macro flags in the target build (as some tutorials are suggesting).  it&#8217;s the same output as NSLog, but that&#8217;s the trade off for not having to write and manage a new class/singleton.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
//Toggle DebugLog() Visibility<br />
#define ShowDebugLogs 0 </p>
<p>//DebugLog() Visibility<br />
#if ShowDebugLogs<br />
	#define DebugLog(&#8230;) NSLog(__VA_ARGS__)<br />
	#else<br />
	#define DebugLog(&#8230;)<br />
#endif</p>
<p>//ReleaseLog() Visibility<br />
#define ReleaseLog(&#8230;) NSLog(__VA_ARGS__)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paulo Oliveira</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html/comment-page-1#comment-5985</link>
		<dc:creator>Paulo Oliveira</dc:creator>
		<pubDate>Mon, 26 Oct 2009 03:02:26 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=225#comment-5985</guid>
		<description>One way to archive the same functionality using only macros:

#define debug() NSLog(@&quot;File:%s, Line:%d : %s&quot;, [ [ [ [NSString alloc] initWithBytes:__FILE__ length:strlen(__FILE__) encoding:NSUTF8StringEncoding] lastPathComponent] UTF8String ] ,__LINE__,__FUNCTION__); 

You can implement the other functions, like full path or other one you require, just changing the all code on the macros. One good idea is define many macros, so you can call one macro inside other.</description>
		<content:encoded><![CDATA[<p>One way to archive the same functionality using only macros:</p>
<p>#define debug() NSLog(@&#8221;File:%s, Line:%d : %s&#8221;, [ [ [ [NSString alloc] initWithBytes:__FILE__ length:strlen(__FILE__) encoding:NSUTF8StringEncoding] lastPathComponent] UTF8String ] ,__LINE__,__FUNCTION__); </p>
<p>You can implement the other functions, like full path or other one you require, just changing the all code on the macros. One good idea is define many macros, so you can call one macro inside other.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html/comment-page-1#comment-422</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 01 Apr 2009 02:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=225#comment-422</guid>
		<description>Chrissy,

To use these classes, create two new files DebugOutput.h and DebugOutput.m in an Xcode project. Copy the code from above into the appropriate file.

From within a file that you want to use the debug statement, import the debug header as follows:

#import &quot;DebugOutput.h&quot;

Then, call the debug statement as shown below changing &#039;someString&#039; and &#039;someValue&#039; as needed to output a debug statement:

debug(@&quot;someString:&quot;, someValue);

Hope that helps.

John</description>
		<content:encoded><![CDATA[<p>Chrissy,</p>
<p>To use these classes, create two new files DebugOutput.h and DebugOutput.m in an Xcode project. Copy the code from above into the appropriate file.</p>
<p>From within a file that you want to use the debug statement, import the debug header as follows:</p>
<p>#import &#8220;DebugOutput.h&#8221;</p>
<p>Then, call the debug statement as shown below changing &#8217;someString&#8217; and &#8217;someValue&#8217; as needed to output a debug statement:</p>
<p>debug(@&#8221;someString:&#8221;, someValue);</p>
<p>Hope that helps.</p>
<p>John</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chrissy</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html/comment-page-1#comment-416</link>
		<dc:creator>Chrissy</dc:creator>
		<pubDate>Tue, 31 Mar 2009 21:09:09 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=225#comment-416</guid>
		<description>Thanks John for an interesting article. I&#039;m a complete Cocoa newbie but come from a programming background. I downloaded your project and gave it a whirl. This would be very useful for me while I plough through Cocoa Programming For Mac OS X. Could you quickly explain how to include this code in other projects. Thanks for your time.</description>
		<content:encoded><![CDATA[<p>Thanks John for an interesting article. I&#8217;m a complete Cocoa newbie but come from a programming background. I downloaded your project and gave it a whirl. This would be very useful for me while I plough through Cocoa Programming For Mac OS X. Could you quickly explain how to include this code in other projects. Thanks for your time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Clint</title>
		<link>http://iPhoneDeveloperTips.com/cocoa/filename-and-line-number-with-nslog-part-ii.html/comment-page-1#comment-242</link>
		<dc:creator>Clint</dc:creator>
		<pubDate>Fri, 20 Feb 2009 21:23:07 +0000</pubDate>
		<guid isPermaLink="false">http://iPhoneDeveloperTips.com/?p=225#comment-242</guid>
		<description>Thanks John--I&#039;ll definitely be using this code in my own projects!

A quick question, though: Why is it necessary to explicitly override and synchronize the +allocWithZone: method? I understand that +allocWithZone: is called by alloc (so in this case you must ensure it&#039;s thread-safe), but your +debugShare: method is already synchronized. Couldn&#039;t you just assign the singleton inside +debugShare: and skip overriding +allocWithZone:?

I&#039;m somewhat new to ObjC so if I&#039;m missing something here, a quick explanation would be a greatly-appreciated lesson.</description>
		<content:encoded><![CDATA[<p>Thanks John&#8211;I&#8217;ll definitely be using this code in my own projects!</p>
<p>A quick question, though: Why is it necessary to explicitly override and synchronize the +allocWithZone: method? I understand that +allocWithZone: is called by alloc (so in this case you must ensure it&#8217;s thread-safe), but your +debugShare: method is already synchronized. Couldn&#8217;t you just assign the singleton inside +debugShare: and skip overriding +allocWithZone:?</p>
<p>I&#8217;m somewhat new to ObjC so if I&#8217;m missing something here, a quick explanation would be a greatly-appreciated lesson.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
