Exemple #1
0
 public function __construct()
 {
     $disabled = @APF::get_instance()->get_config(self::CONFIG_N_DISABLED, self::CONFIG_F_LOGGER);
     $this->disabled = (bool) $disabled;
     if ($disabled) {
         return;
     }
     $threhold = @intval(APF::get_instance()->get_config(self::CONFIG_N_THREHOLD, self::CONFIG_F_LOGGER));
     $this->threhold = $threhold ? $threhold : 10;
     $tag_prefix = @APF::get_instance()->get_config(self::CONFIG_N_TAG_PREFIX, self::CONFIG_F_LOGGER);
     $this->tag_prefix = $tag_prefix ? $tag_prefix : '';
     $host = @APF::get_instance()->get_config(self::CONFIG_N_HOST, self::CONFIG_F_LOGGER);
     $port = @APF::get_instance()->get_config(self::CONFIG_N_PORT, self::CONFIG_F_LOGGER);
     $this->logger = Util_Nlog_FluentLogger::open($host, $port);
     APF::get_instance()->register_shutdown_function(array($this, 'shutdown'));
 }
 /**
  * clear fluent-logger instances from static variable.
  *
  * this useful when testing.
  *
  * @return void
  */
 public static function clearInstances()
 {
     foreach (self::$instances as $object) {
         unset($object);
     }
     self::$instances = array();
 }