


<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Learn DooPHP &#187; normal</title>
	<atom:link href="http://learn.doophp.com/tag/normal/feed/" rel="self" type="application/rss+xml" />
	<link>http://learn.doophp.com</link>
	<description>Learn DooPHP - a high performance MVC based PHP framework</description>
	<lastBuildDate>Thu, 18 Aug 2011 19:47:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using DooPHP Logging Tools</title>
		<link>http://learn.doophp.com/2009/12/using-doophp-logging-tools/</link>
		<comments>http://learn.doophp.com/2009/12/using-doophp-logging-tools/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 02:58:16 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Demos & Snippets]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[normal]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=154</guid>
		<description><![CDATA[<p>DooPHP comes with its own <strong>profiler and logging tool</strong> by default. The class that handle this in the framework is DooLog (<em>dooframework/app/logging/DooLog.php</em>)</p>
<p>There are a few methods in this file where you can use for profiling and logging queries or important message in your application. You can log a message by calling:</p>
<pre class="brush: php;">
Doo::logger()-&#62;log('Something fishy here!', DooLog::Alert);
</pre>
<p>Or you can use the Alias methods instead of passing the log level:</p>
<pre class="brush: php;">
Doo::logger()-&#62;alert('Something fishy here!');
Doo::logger()-&#62;emerg('message...');
Doo::logger()-&#62;crit('message...');
Doo::logger()-&#62;err('message...');
Doo::logger()-&#62;warn('message...');
Doo::logger()-&#62;notice('message...');
Doo::logger()-&#62;info('message...');
Doo::logger()-&#62;trace('message...');
</pre>
<p>All of the log messages can be organized by category, simply pass in another parameter at the end of the methods:</p>
<pre class="brush: php;">
Doo::logger()-&#62;log('Something fishy here!', DooLog::ALERT, 'editpost');
Doo::logger()-&#62;emerg('message...', 'editpost');
Doo::logger()-&#62;alert('message...', 'editpost');
</pre>
<p>To view the logged messages, you just have to call showLogs(). By default DooLog will return a neatly formatted XML log which can be filtered by level or category. You can get a plain text log if you need so:</p>
<pre class="brush: php;">
//display all logs
echo Doo::logger()-&#62;showLogs();

//display plain text log
echo Doo::logger()-&#62;showLogs(false);

//display only logs in category editpost
echo Doo::logger()-&#62;showLogs(true, null, 'editpost');

//display only logs in level Alert and category editpost
echo Doo::logger()-&#62;showLogs(true, DooLog::ALERT, 'editpost');
</pre>
<p>When you have to write the log messages into file, all you have to do is call writeLogs(). Similar to showLogs(), it writes the XML string to file by default.</p>
<pre class="brush: php;">

//Creates a log file</pre>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/12/using-doophp-logging-tools/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
