<?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>DaveOnCode &#187; debug</title>
	<atom:link href="http://www.daveoncode.com/tag/debug/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.daveoncode.com</link>
	<description>coder and technology lover</description>
	<lastBuildDate>Sun, 16 May 2010 16:55:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Debugging PhoneGap applications using Xcode console</title>
		<link>http://www.daveoncode.com/2010/01/12/debugging-phonegap-applications-using-xcode-console/</link>
		<comments>http://www.daveoncode.com/2010/01/12/debugging-phonegap-applications-using-xcode-console/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 10:13:59 +0000</pubDate>
		<dc:creator>Davide Zanotti</dc:creator>
				<category><![CDATA[phonegap]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.daveoncode.com/?p=580</guid>
		<description><![CDATA[When I started to play whit PhoneGap, my greatest issue was: &#8220;how can I debug my code?&#8221;, I use often tools such FireBug and JavaScript debugger included in Internet Explorer 8 (which is the first good thing IE has to offers!) but write and test my code on iPhone simulator is completely different. Fortunately PhoneGap]]></description>
			<content:encoded><![CDATA[<p>When I started to play whit <strong>PhoneGap</strong>, my greatest issue was: &#8220;how can I debug my code?&#8221;, I use often tools such <strong>FireBug</strong> and JavaScript debugger included in Internet Explorer 8 (which is the first good thing IE has to offers!) but write and test my code on iPhone simulator is completely different. Fortunately PhoneGap offers a way to access to <strong>Xcode</strong> console and print messages by choosing among three different levels: <strong>log</strong>, <strong>warn</strong> and <strong>error</strong>. In order to print a message, we have to use the <strong>debug</strong> object, which has scope <strong>window</strong> (it is a global object), in this way:</p>
<div class="codecolorer-container javascript mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">debug.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;my log message&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// or</span><br />
debug.<span style="color: #660066;">warn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;my warning message&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// or</span><br />
debug.<span style="color: #660066;">error</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;my error message&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>To open Xcode console you have to choose &#8220;Run -> Console&#8221; from the toolbar (or CMD+SHIFT+R) and after a &#8220;Build and Run&#8221; (CMD+Enter), you will see your message appear in the console.<br />
Testing applications while developing using PhoneGap and Xcode, is an intense activity, because errors are not automatically notified (like in FireBug or similar), so it&#8217;s really important to make use of <strong>try/catch/finally</strong> blocks and logging calls:</p>
<div class="codecolorer-container javascript mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; mycommand.<span style="color: #660066;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; debug.<span style="color: #660066;">error</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Error using mycommand: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #660066;">message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">finally</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// do something smart here :^)</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Finally, in order to avoid problems related to Xcode cache, I suggest to always clean the cache by running &#8220;Build -> Clean&#8221; from the toolbar (or CMD+SHIFT+K) before doing a new build and eventually remove the application folder under &#8220;/Users/{your-name}/Library/Application Support/iPhone Simulator/User/Applications/{app-number}&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daveoncode.com/2010/01/12/debugging-phonegap-applications-using-xcode-console/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extending Flex&#8217;s logging framework to write custom log files</title>
		<link>http://www.daveoncode.com/2009/02/23/extending-flexs-logging-framework-to-write-custom-log-files/</link>
		<comments>http://www.daveoncode.com/2009/02/23/extending-flexs-logging-framework-to-write-custom-log-files/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 18:19:06 +0000</pubDate>
		<dc:creator>Davide Zanotti</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.daveoncode.com/?p=308</guid>
		<description><![CDATA[In these days I played with Flex&#8217;s logging framework and I extended it to write log messages to files, both plain text .log files and dynamic HTML, CSS formatted and Javascript powered files with the ability to filter message type (debug, error, fatal and so on). The logging framework is a powerful feature that comes]]></description>
			<content:encoded><![CDATA[<p>In these days I played with Flex&#8217;s logging framework and I extended it to write log messages to files, both plain text .log files and dynamic HTML, CSS formatted and Javascript powered files with the ability to filter message type (debug, error, fatal and so on).</p>
<p>The logging framework is a powerful feature that comes with Flex&#8217;s sdk and it&#8217;s composed by the classes under <strong>mx.logging </strong>package, which includes the two &#8220;subpackages&#8221; <strong>mx.logging.errors</strong> and <strong>mx.logging.target</strong>.</p>
<p>Java developers should be already confident whit such framework, because logging api are commonly used in Java programming,  Actionscript /Flash/Flex developers may find this tool a novelty (as I did).</p>
<p>The objective of logging framework is to provide a tool that offers a far better, flexible and centralized way to debug an application than simple use a lot of <strong>trace()</strong> callings. With Flex&#8217;s debugging framework we are able to print and filtering among different types of message based on their severity, such:</p>
<ul>
<li>DEBUG</li>
<li>ERROR</li>
<li>FATAL</li>
<li>INFO</li>
<li>WARN</li>
</ul>
<p>We can also print the timestamp of the message and the class it refers to, and finally we can simultaneously print messages to different targets.</p>
<p><span id="more-308"></span></p>
<h3 style="margin: 20px 0">How it works</h3>
<p>The logging framework is basically represented by 3 units: a logger, a target and a log event. The first component is the main class of the framework and its job is to register the different &#8220;loggable classes&#8221;, register one or more targets and dispatch log events. A target is a class which receives a LogEvent event and handles it by printing its information (message, date, level&#8230;) somewhere. A LogEvent event is dispatched when one of the logger methods such: <strong>debug()</strong>, <strong>error()</strong>, <strong>fatal()</strong>, <strong>info()</strong>, <strong>log()</strong> or <strong>warn()</strong> is called.</p>
<p>The steps required to use the logging system are the following:</p>
<p>1. Registering the classes for logging:</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span> com<span style="color: #000066; font-weight: bold;">.</span>daveoncode <span style="color: #000000;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>logging<span style="color: #000066; font-weight: bold;">.*;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Foo <span style="color: #000000;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _logger<span style="color: #000066; font-weight: bold;">:</span>ILogger<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Foo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>_logger = Log<span style="color: #000066; font-weight: bold;">.</span>getLogger<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;com.daveoncode.Foo&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>_logger<span style="color: #000066; font-weight: bold;">.</span>debug<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;debugging message from Foo class&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>_logger<span style="color: #000066; font-weight: bold;">.</span>warn<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;warning message from Foo class&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>The code above will register the class Foo under the package com.daveoncode and then it will broadcast a debug and a warning message</p>
<p>2. Initialize and configure a logging target such TraceTarget (typically in the main class):</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> basicTarget<span style="color: #000066; font-weight: bold;">:</span>TraceTarget = <span style="color: #0033ff; font-weight: bold;">new</span> TraceTarget<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Apply filters</span><br />
basicTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">filters</span> = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;com.daveoncode.*&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Log all log levels.</span><br />
basicTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">level</span> = LogEventLevel<span style="color: #000066; font-weight: bold;">.</span>ALL<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Add date, time, category, and log level to the output</span><br />
basicTarget<span style="color: #000066; font-weight: bold;">.</span>includeDate = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
basicTarget<span style="color: #000066; font-weight: bold;">.</span>includeTime = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
basicTarget<span style="color: #000066; font-weight: bold;">.</span>includeCategory = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
basicTarget<span style="color: #000066; font-weight: bold;">.</span>includeLevel = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<p>The code above will print log messages of all &#8220;subscribed&#8221; classes inside the package com.daveoncode, including all information available (date, time, category, level)</p>
<p>3. Add the target to the logger:</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Log<span style="color: #000066; font-weight: bold;">.</span>addTarget<span style="color: #000000;">&#40;</span>basicTarget<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<p>The previous steps can be repeated as many times as we need, in order to registering several classes and several targets (<span onclick="dr4sdgryt(event)">perhaps </span>with different filters and info settings).</p>
<h3 style="margin: 20px 0">How to extend the framework</h3>
<p>To extend the framework we can create new target classes, which print LogEvent data to different location and display data as we like. In my experiment I created a &#8220;mini subframework&#8221; which can print logs to text files or html files. I created the following 7 classes:</p>
<ol>
<li>LogFileTarget</li>
<li>IStreamDataWriter</li>
<li>AbstractDataWriter</li>
<li>PlainTextDataWriter</li>
<li>HTMLDataWriter</li>
<li>InvalidLogFileTargetError</li>
<li>UnsupportedWriteModeError</li>
</ol>
<p>The first, as the name suggest is a custom target class, which extends LineFormattedTarget (a target class available in Flex&#8217;s framework), it has a parametric constructor which allows the user to choose the name of the file, its directory, the type of file (txt or html) and the charset that will be used to write the file. IStreamDataWriter is an interface which simply declares one method called writeData(), the main purpose of this interface is to use it in polymorphism. IStreamDataWriter is implemented by AbstractDataWriter as an abstract method (abstract is not supported yet in as3, but is treated as abstract), this class also has a secondary method which is used by two subclasses <strong>PlainTextDataWriter </strong>and <strong>HTMLDataWriter</strong>. These classes have the duty to physically write data to the file by handling the event received by <strong>LogFileTarget </strong>which delegates the business logic to them and are used based on the writeMode configuration of  <strong>LogFileTarget</strong>, which for ease has two public constants called <strong>MODE_PLAIN_TEXT</strong> and <strong>MODE_HTML. InvalidLogFileTargetError</strong> and <strong>UnsupportedWriteModeError </strong>are obviously two custom error which are both (potentially) thrown by <strong>LogFileTarget.</strong></p>
<p>This is a sample code using my own classes:</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900; font-style: italic;">// this will print to an html file</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> HTMLTarget<span style="color: #000066; font-weight: bold;">:</span>LogFileTarget = <span style="color: #0033ff; font-weight: bold;">new</span> LogFileTarget<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;applicationLog&quot;</span><span style="color: #000066; font-weight: bold;">,</span> File<span style="color: #000066; font-weight: bold;">.</span>desktopDirectory<span style="color: #000066; font-weight: bold;">,</span> LogFileTarget<span style="color: #000066; font-weight: bold;">.</span>MODE_HTML<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// this will print to a txt file</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> txtTarget<span style="color: #000066; font-weight: bold;">:</span>LogFileTarget = <span style="color: #0033ff; font-weight: bold;">new</span> LogFileTarget<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;applicationLog&quot;</span><span style="color: #000066; font-weight: bold;">,</span> File<span style="color: #000066; font-weight: bold;">.</span>desktopDirectory<span style="color: #000066; font-weight: bold;">,</span> LogFileTarget<span style="color: #000066; font-weight: bold;">.</span>MODE_PLAIN_TEXT<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
HTMLTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">filters</span> = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;*&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp;<span style="color: #009900; font-style: italic;">// Log all log levels.</span><br />
HTMLTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">level</span> = LogEventLevel<span style="color: #000066; font-weight: bold;">.</span>ALL<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Add date, time, category, and log level to the output.</span><br />
HTMLTarget<span style="color: #000066; font-weight: bold;">.</span>includeDate = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
HTMLTarget<span style="color: #000066; font-weight: bold;">.</span>includeTime = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
HTMLTarget<span style="color: #000066; font-weight: bold;">.</span>includeCategory = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
HTMLTarget<span style="color: #000066; font-weight: bold;">.</span>includeLevel = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
txtTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">filters</span> = <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;*&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Log all log levels.</span><br />
txtTarget<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">level</span> = LogEventLevel<span style="color: #000066; font-weight: bold;">.</span>ALL<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Add date, time, category, and log level to the output.</span><br />
txtTarget<span style="color: #000066; font-weight: bold;">.</span>includeDate = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
txtTarget<span style="color: #000066; font-weight: bold;">.</span>includeTime = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
txtTarget<span style="color: #000066; font-weight: bold;">.</span>includeCategory = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
txtTarget<span style="color: #000066; font-weight: bold;">.</span>includeLevel = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// Add targets</span><br />
Log<span style="color: #000066; font-weight: bold;">.</span>addTarget<span style="color: #000000;">&#40;</span>HTMLTarget<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
Log<span style="color: #000066; font-weight: bold;">.</span>addTarget<span style="color: #000000;">&#40;</span>txtTarget<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<p>Of course this experiment will works only in AIR applications, because we need to use flash.fileystem classes.</p>
<p>These are the two different output that my classes will generate:<br />
<a href="http://www.daveoncode.com/_dave_stuff/samples/applicationLog.log">Text file</a><br />
<a href="http://www.daveoncode.com/_dave_stuff/samples/applicationLog.html">HTML file</a></p>
<p>The cool aspect of html version (LogFileTarget.MODE_HTML) is that you can filter by log type :)</p>
<p>If you want to use or take a look to my experiment, feel free to download my logging package <a href="http://www.daveoncode.com/_dave_stuff/doc_logging_framework-1.0.zip">here</a> (let me know your opinion)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daveoncode.com/2009/02/23/extending-flexs-logging-framework-to-write-custom-log-files/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
