home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 136 / MOBICLIC136.ISO / pc / DATA / HOTE / libs / amfphp / amfphp.swf / scripts / __Packages / mx / services / Log.as
Text File  |  2011-07-20  |  1KB  |  44 lines

  1. class mx.services.Log
  2. {
  3.    static var NONE = -1;
  4.    static var BRIEF = 0;
  5.    static var VERBOSE = 1;
  6.    static var DEBUG = 2;
  7.    function Log(logLevel, name)
  8.    {
  9.       this.level = logLevel != undefined ? logLevel : mx.services.Log.BRIEF;
  10.       this.name = name != undefined ? name : "";
  11.    }
  12.    function logInfo(msg, level)
  13.    {
  14.       if(level == undefined)
  15.       {
  16.          level = mx.services.Log.BRIEF;
  17.       }
  18.       if(level <= this.level)
  19.       {
  20.          if(level == mx.services.Log.DEBUG)
  21.          {
  22.             this.onLog(this.getDateString() + " [DEBUG] " + this.name + ": " + msg);
  23.          }
  24.          else
  25.          {
  26.             this.onLog(this.getDateString() + " [INFO] " + this.name + ": " + msg);
  27.          }
  28.       }
  29.    }
  30.    function logDebug(msg)
  31.    {
  32.       this.logInfo(msg,mx.services.Log.DEBUG);
  33.    }
  34.    function getDateString()
  35.    {
  36.       var _loc1_ = new Date();
  37.       return _loc1_.getMonth() + 1 + "/" + _loc1_.getDate() + " " + _loc1_.getHours() + ":" + _loc1_.getMinutes() + ":" + _loc1_.getSeconds();
  38.    }
  39.    function onLog(message)
  40.    {
  41.       trace(message);
  42.    }
  43. }
  44.