Also useful: Use begin and end to indent the log, helps you follow logs in
recursive processes (within one class):
package pathways.logging
{
import flash.events.Event;
import flash.events.EventDispatcher;
import mx.logging.ILogger;
public class AdvancedLogger extends EventDispatcher implements ILogger
{
private var inner : ILogger;
private var operationDepth : Number = 0;
public function AdvancedLogger(wrappedLogger : ILogger)
{
inner = wrappedLogger;
}
public function get category():String
{
return inner.category;
}
public function beginOperation() : void
{
operationDepth++;
}
public function endOperation() : void
{
operationDepth = operationDepth > 0 ? operationDepth - 1 : 0;
}
private function pad(message : String) : String
{
var padding : String = "";
for (var i : Number = 0; i < operationDepth; i++)
{
padding += " ";
}
return padding + message;
}
public function log(level : int, message : String, ...parameters) :
void
{
parameters.unshift(pad(message));
parameters.unshift(level);
(inner.log).apply(inner, parameters);
}
public function debug(message:String, ...parameters):void
{
parameters.unshift(pad(message));
(inner.debug).apply(inner, parameters);
}
public function error(message:String, ...parameters):void
{
parameters.unshift(pad(message));
(inner.error).apply(inner, parameters);
}
public function fatal(message:String, ...parameters):void
{
parameters.unshift(pad(message));
(inner.fatal).apply(inner, parameters);
}
public function info(message:String, ...parameters):void
{
parameters.unshift(pad(message));
(inner.info).apply(inner, parameters);
}
public function warn(message:String, ...parameters):void
{
parameters.unshift(pad(message));
(inner.warn).apply(inner, parameters);
}
}
}
On Wed, Oct 8, 2008 at 6:58 AM, Matt Chotin <[EMAIL PROTECTED]> wrote:
> And you know that there's a small logging framework in Flex itself right?
> Mx.logging...
>
>
> On 10/6/08 9:27 PM, "Anatole Tartakovsky" <[EMAIL PROTECTED]>
> wrote:
>
>
>
>
> have you looked at myflex.org <http://myflex.org> ?
> Thank you
> Anatole
>
>
> On Mon, Oct 6, 2008 at 5:14 AM, Shahid Faiz <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi,
>
> Does anyone know log4j like library for AIR applications? It is really hard
> to trace a problem when application is in testing or production without such
> utility.
>
> Thanks,
> Shahid
>
>
>
>
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>
--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."
http://flex.joshmcdonald.info/
:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]