コード例 #1
0
 /**
  * {@inheritDoc}
  */
 protected function write(array $record)
 {
     $data = $record['context'];
     $data['level'] = Logger::getLevelName($record['level']);
     $data['message'] = $record['message'];
     $this->logger->post($record['channel'], $data);
 }
 public function save(Article $article)
 {
     $metadata = $this->entityManager->getClassMetadata(get_class($article));
     $type = "app." . $metadata->getTableName();
     $this->fluentLogger->post($type, array_filter($this->serializer->normalize($article), function ($idx) {
         return $idx != 'id';
     }, ARRAY_FILTER_USE_KEY));
 }
コード例 #3
0
function execute()
{
    //$logger = new FluentLogger("tcp://0.0.0.0:24224");
    $logger = new FluentLogger("unix:///tmp/fluent");
    for (;;) {
        $logger->post("debug.test", $_SERVER);
        echo '.';
    }
}
コード例 #4
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);
 }
コード例 #5
0
 public function testGetOption()
 {
     $logger = new FluentLogger("localhost", 119223);
     $this->assertEquals(FluentLogger::CONNECTION_TIMEOUT, $logger->getOption("socket_timeout"), "getOptions retunrs unexpected value");
 }
コード例 #6
0
 /**
  * {@inheritdoc}
  */
 public function close()
 {
     $this->fluentLogger->close();
 }
コード例 #7
0
 /**
  * {@inheritDoc}
  */
 public function write(array $record)
 {
     $record['level'] = Logger::getLevelName($record['level']);
     $tag = $record['channel'] . '.' . $record['message'];
     $this->logger->post($tag, $record);
 }
コード例 #8
0
ファイル: index.php プロジェクト: nagyist/fluent-logger-php
<?php

require_once dirname(dirname(__DIR__)) . '/src/Fluent/Autoloader.php';
use Fluent\Logger\FluentLogger;
Fluent\Autoloader::register();
$begin = microtime(true);
$logger = new FluentLogger("unix:///tmp/fluent");
//$logger = new FluentLogger("tcp://0.0.0.0:24224", null, array("persistent"=> true));
for ($i = 0; $i < 10; $i++) {
    $logger->post("debug.test", $_SERVER);
}
$end = microtime(true);
echo "OK" . PHP_EOL;
printf("%6f\n", $end - $begin);
コード例 #9
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->_logger = FluentLogger::open($this->host, $this->port, $this->options);
 }
コード例 #10
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"}