<?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: Debugging with $.log() or log()</title>
	<atom:link href="http://james.padolsey.com/javascript/debugging-with-log-or-log/feed/" rel="self" type="application/rss+xml" />
	<link>http://james.padolsey.com/javascript/debugging-with-log-or-log/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 02 Feb 2012 18:03:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: Paul Irish</title>
		<link>http://james.padolsey.com/javascript/debugging-with-log-or-log/comment-page-1/#comment-2138</link>
		<dc:creator>Paul Irish</dc:creator>
		<pubDate>Wed, 31 Dec 2008 23:52:24 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=309#comment-2138</guid>
		<description>James,

Great posts lately. 

I was using a similar script (with console.log.apply), but saw that Safari and Chrome&#039;s consoles don&#039;t play nicely with it.

This seemed to be an ugly but functional cross browser solution:

&lt;pre lang=&quot;javascript&quot;&gt;
window.debug = function(q,w,e,r,t,y){  
  try { console &amp;&amp; console.log &amp;&amp; console.log.apply(console,arguments); } 
  catch(e){ console &amp;&amp; console.log &amp;&amp; console.log(q,w,e,r,t,y); }
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>James,</p>
<p>Great posts lately. </p>
<p>I was using a similar script (with console.log.apply), but saw that Safari and Chrome&#8217;s consoles don&#8217;t play nicely with it.</p>
<p>This seemed to be an ugly but functional cross browser solution:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span class="me1">debug</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span>q<span class="sy0">,</span>w<span class="sy0">,</span>e<span class="sy0">,</span>r<span class="sy0">,</span>t<span class="sy0">,</span>y<span class="br0">&#41;</span><span class="br0">&#123;</span>  
  <span class="kw1">try</span> <span class="br0">&#123;</span> console <span class="sy0">&amp;&amp;</span> console.<span class="me1">log</span> <span class="sy0">&amp;&amp;</span> console.<span class="me1">log</span>.<span class="me1">apply</span><span class="br0">&#40;</span>console<span class="sy0">,</span>arguments<span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span> 
  <span class="kw1">catch</span><span class="br0">&#40;</span>e<span class="br0">&#41;</span><span class="br0">&#123;</span> console <span class="sy0">&amp;&amp;</span> console.<span class="me1">log</span> <span class="sy0">&amp;&amp;</span> console.<span class="me1">log</span><span class="br0">&#40;</span>q<span class="sy0">,</span>w<span class="sy0">,</span>e<span class="sy0">,</span>r<span class="sy0">,</span>t<span class="sy0">,</span>y<span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://james.padolsey.com/javascript/debugging-with-log-or-log/comment-page-1/#comment-2105</link>
		<dc:creator>James</dc:creator>
		<pubDate>Wed, 31 Dec 2008 11:46:34 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=309#comment-2105</guid>
		<description>@Balazs, good point, just changed it. :)</description>
		<content:encoded><![CDATA[<p>@Balazs, good point, just changed it. <img src='http://james.padolsey.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Balazs Endresz</title>
		<link>http://james.padolsey.com/javascript/debugging-with-log-or-log/comment-page-1/#comment-2100</link>
		<dc:creator>Balazs Endresz</dc:creator>
		<pubDate>Wed, 31 Dec 2008 10:59:40 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=309#comment-2100</guid>
		<description>Hey, why are you using an internal undocumented object to store data? You can store the log on the $.log function itself!

&lt;pre lang=&quot;javascript&quot;&gt;
$.log = $.fn.log = function(o) {
  //...
  $.log.cache[$.log.cache.length] = arguments.length &gt; 1 ? arguments : o &#124;&#124; this;
}

$.log.cache=[];
&lt;/pre&gt;

Anyway, some useful stuff again!</description>
		<content:encoded><![CDATA[<p>Hey, why are you using an internal undocumented object to store data? You can store the log on the $.log function itself!</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span class="me1">log</span> <span class="sy0">=</span> $.<span class="me1">fn</span>.<span class="me1">log</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span>o<span class="br0">&#41;</span> <span class="br0">&#123;</span>
  <span class="co1">//...</span>
  $.<span class="me1">log</span>.<span class="me1">cache</span><span class="br0">&#91;</span>$.<span class="me1">log</span>.<span class="me1">cache</span>.<span class="me1">length</span><span class="br0">&#93;</span> <span class="sy0">=</span> arguments.<span class="me1">length</span> <span class="sy0">&amp;</span>gt<span class="sy0">;</span> <span class="nu0">1</span> <span class="sy0">?</span> arguments <span class="sy0">:</span> o <span class="sy0">||</span> <span class="kw1">this</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
$.<span class="me1">log</span>.<span class="me1">cache</span><span class="sy0">=</span><span class="br0">&#91;</span><span class="br0">&#93;</span><span class="sy0">;</span></pre></div></div>

<p>Anyway, some useful stuff again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe McCann</title>
		<link>http://james.padolsey.com/javascript/debugging-with-log-or-log/comment-page-1/#comment-2069</link>
		<dc:creator>Joe McCann</dc:creator>
		<pubDate>Tue, 30 Dec 2008 22:21:37 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=309#comment-2069</guid>
		<description>Nice, will be using this instead of my own lil snippet while developing jQuery plugins.</description>
		<content:encoded><![CDATA[<p>Nice, will be using this instead of my own lil snippet while developing jQuery plugins.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

