Пример #1
0
 public function __construct($config = array())
 {
     $config = Hash::merge($this->_defaults, $config);
     if (is_null($this->logger)) {
         $this->logger = FluentLogger::open($config['host'], $config['port']);
     }
     parent::__construct($config);
 }
 public function testClearInstances()
 {
     $prop = new \ReflectionProperty("\\Fluent\\Logger\\FluentLogger", "instances");
     $prop->setAccessible(true);
     FluentLogger::open("localhost", 1191);
     FluentLogger::open("localhost", 1192);
     $this->assertCount(2, $prop->getValue("FluentLogger"));
     FluentLogger::clearInstances();
     $this->assertCount(0, $prop->getValue("FluentLogger"));
 }
Пример #3
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->_logger = FluentLogger::open($this->host, $this->port, $this->options);
 }
Пример #4
0
<?php

require_once __DIR__ . '/../src/Fluent/Autoloader.php';
use Fluent\Autoloader, Fluent\Logger\ConsoleLogger, Fluent\Logger\FluentLogger, Fluent\Logger\HttpLogger;
Autoloader::register();
//$logger = ConsoleLogger::open("debug.test",fopen("php://stdout","w"));
$logger = FluentLogger::open("localhost", "24224");
//$logger = HttpLogger::open("debug.test","localhost","8888");
/* simple request */
$logger->post("debug.test", array("hello" => "world"));
// 2011-10-01 03:33:34 +0900 debug.test: {"hello":"world"}