home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / mx / logging / LogLogger.as < prev   
Encoding:
Text File  |  2010-06-23  |  3.7 KB  |  127 lines

  1. package mx.logging
  2. {
  3.    import flash.events.EventDispatcher;
  4.    import mx.core.mx_internal;
  5.    import mx.resources.IResourceManager;
  6.    import mx.resources.ResourceManager;
  7.    
  8.    use namespace mx_internal;
  9.    
  10.    public class LogLogger extends EventDispatcher implements ILogger
  11.    {
  12.       mx_internal static const VERSION:String = "3.5.0.12683";
  13.       
  14.       private var _category:String;
  15.       
  16.       private var resourceManager:IResourceManager = ResourceManager.getInstance();
  17.       
  18.       public function LogLogger(param1:String)
  19.       {
  20.          super();
  21.          _category = param1;
  22.       }
  23.       
  24.       public function log(param1:int, param2:String, ... rest) : void
  25.       {
  26.          var _loc4_:String = null;
  27.          var _loc5_:int = 0;
  28.          if(param1 < LogEventLevel.DEBUG)
  29.          {
  30.             _loc4_ = resourceManager.getString("logging","levelLimit");
  31.             throw new ArgumentError(_loc4_);
  32.          }
  33.          if(hasEventListener(LogEvent.LOG))
  34.          {
  35.             _loc5_ = 0;
  36.             while(_loc5_ < rest.length)
  37.             {
  38.                param2 = param2.replace(new RegExp("\\{" + _loc5_ + "\\}","g"),rest[_loc5_]);
  39.                _loc5_++;
  40.             }
  41.             dispatchEvent(new LogEvent(param2,param1));
  42.          }
  43.       }
  44.       
  45.       public function error(param1:String, ... rest) : void
  46.       {
  47.          var _loc3_:int = 0;
  48.          if(hasEventListener(LogEvent.LOG))
  49.          {
  50.             _loc3_ = 0;
  51.             while(_loc3_ < rest.length)
  52.             {
  53.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  54.                _loc3_++;
  55.             }
  56.             dispatchEvent(new LogEvent(param1,LogEventLevel.ERROR));
  57.          }
  58.       }
  59.       
  60.       public function warn(param1:String, ... rest) : void
  61.       {
  62.          var _loc3_:int = 0;
  63.          if(hasEventListener(LogEvent.LOG))
  64.          {
  65.             _loc3_ = 0;
  66.             while(_loc3_ < rest.length)
  67.             {
  68.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  69.                _loc3_++;
  70.             }
  71.             dispatchEvent(new LogEvent(param1,LogEventLevel.WARN));
  72.          }
  73.       }
  74.       
  75.       public function get category() : String
  76.       {
  77.          return _category;
  78.       }
  79.       
  80.       public function info(param1:String, ... rest) : void
  81.       {
  82.          var _loc3_:int = 0;
  83.          if(hasEventListener(LogEvent.LOG))
  84.          {
  85.             _loc3_ = 0;
  86.             while(_loc3_ < rest.length)
  87.             {
  88.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  89.                _loc3_++;
  90.             }
  91.             dispatchEvent(new LogEvent(param1,LogEventLevel.INFO));
  92.          }
  93.       }
  94.       
  95.       public function debug(param1:String, ... rest) : void
  96.       {
  97.          var _loc3_:int = 0;
  98.          if(hasEventListener(LogEvent.LOG))
  99.          {
  100.             _loc3_ = 0;
  101.             while(_loc3_ < rest.length)
  102.             {
  103.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  104.                _loc3_++;
  105.             }
  106.             dispatchEvent(new LogEvent(param1,LogEventLevel.DEBUG));
  107.          }
  108.       }
  109.       
  110.       public function fatal(param1:String, ... rest) : void
  111.       {
  112.          var _loc3_:int = 0;
  113.          if(hasEventListener(LogEvent.LOG))
  114.          {
  115.             _loc3_ = 0;
  116.             while(_loc3_ < rest.length)
  117.             {
  118.                param1 = param1.replace(new RegExp("\\{" + _loc3_ + "\\}","g"),rest[_loc3_]);
  119.                _loc3_++;
  120.             }
  121.             dispatchEvent(new LogEvent(param1,LogEventLevel.FATAL));
  122.          }
  123.       }
  124.    }
  125. }
  126.  
  127.