Logger problem ?

Added by Murat Pak 653 days ago

I want to agg a logger to print all of the action to a dynamic text field. How is that possible ?

import net.user1.logger.Logger;

did that but here is the error

1120: Access of undefined property LogEvent.
1120: Access of undefined property updateListener.


Replies

RE: Logger problem ? - Added by colin moock 653 days ago

here's an example showing how to add log messages to a text field. i've added this example to the reactor docs for alpha 8.

package {
  import flash.display.Sprite;
  import flash.text.TextField;

  import net.user1.logger.LogEvent;
  import net.user1.logger.Logger;
  import net.user1.reactor.*;

  public class UTest extends Sprite {
    protected var reactor:Reactor;
    protected var logOutput:TextField;

    public function UTest () {
      // Create the log output text field
      logOutput = new TextField();
      logOutput.border = true;
      logOutput.background = true;
      logOutput.width = 500;
      logOutput.height = 300;
      addChild(logOutput);

      // Register for log updates
      reactor = new Reactor();
      reactor.getLog().setLevel(Logger.DEBUG);
      reactor.getLog().addEventListener(LogEvent.UPDATE, logUpdateListener);
      reactor.getLog().debug("Hello world!");
    }

    public function logUpdateListener (e:LogEvent):void {
      logOutput.appendText(e.getTimeStamp() + " " 
                           + e.getLevel() + ": " 
                           + e.getMessage() + "\n");
      logOutput.scrollV = logOutput.maxScrollV;
    }
  }
}