BefittingTheorem
BefittingTheorem

Reputation: 10629

Logging API for AS3

quick question, I've been looking for a simple logging tool for AS3 projects (I do not want any Flex dependencies) and my impression so far has been that there is no actively developed project.

What I need is basic logging, and adapters to allow me to send logging to file (using AIR and a LocalConnection maybe) and maybe send to html div etc.

Anyone have any opinions on a simple, light weight project?

Upvotes: 10

Views: 12731

Answers (7)

Viktor Nordling
Viktor Nordling

Reputation: 9324

I found the best solution for me is combining as3commons-logging with Arthropod, like so:

LOGGER_FACTORY.setup = new SimpleTargetSetup(mergeTargets(new TraceTarget(), new ArthropodTarget()));

Then, if you have a client who is having issues but can't tail the flashlog, they can just fire up Arhtropod. Awesome!

Upvotes: 0

LessQuesar
LessQuesar

Reputation: 3203

MonsterDebugger has more options than it sounds like you're looking for. But it is small and has some very handy features. Including instance inspection, editing properties, calling methods remotely from the air console, and browsing/editing the display tree.

http://monsterdebugger.com/

They made a game so you could learn the debugger, its great.

Upvotes: 0

Dave Geurts
Dave Geurts

Reputation:

This is the best as3 logger by far!!!!

http://arthropod.stopp.se/

Upvotes: 5

Jason Crist
Jason Crist

Reputation: 138

I've got a Flash-friendly logging project going. It's nothing big (yet?) but it's light and handy. It does (optionally) take advantage of Arthropod (a great project) but you can pretty easily shoot the output anywhere you like. It works similarly to the Flex framework so if you are familiar with that then the transition would be painless.

You can read about the project and download the goods here.

Upvotes: 0

Rhys Causey
Rhys Causey

Reputation: 787

There is a standard Logging API in AS3. You can set it up to log to different targets. For instance, if you're using AIR, you could get it to log to a file using the FileTarget in as3corelib.

Setting up:

var logFile:File = File.applicationStorageDirectory.resolvePath("logs/logfile.log");
var logTarget:FileTarget = new FileTarget(logFile);
logTarget.filters = ["path.to.Class"];
logTarget.level = LogEventLevel.ALL;
logTarget.includeDate = true;
logTarget.includeTime = true;
logTarget.includeCategory = true;
logTarget.includeLevel = true;
Log.addTarget(logTarget);

Logging:

var log:ILogger = Log.getLogger("path.to.Class");
log.info("testing the logging...");

Upvotes: 4

Jonathan Dumaine
Jonathan Dumaine

Reputation: 5756

I'm always surprised at the number of people who haven't heard of Arthropod. It does everything you described and more. Including password encrypted connections. Arthropod is also set up in a way that it is very easy to make quick edits to the class for your specific needs.

Upvotes: 1

Christophe Herreman
Christophe Herreman

Reputation: 16085

We have recently started a project called AS3Commons that contains an early implementation of an AS3 Logging framework. We're aiming to provide a Logging abstraction API that allows you to plug in adapters for other logging frameworks. We also have a built-in logger that logs using trace.

It's usage is similar to other logging frameworks.

private static var logger:ILogger = LoggerFactory.getLogger("com.domain.Class");

Check it at http://code.google.com/p/as3-commons/

Any feedback is appreciated.

Upvotes: 7

Related Questions