/** * {@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)); }
function execute() { //$logger = new FluentLogger("tcp://0.0.0.0:24224"); $logger = new FluentLogger("unix:///tmp/fluent"); for (;;) { $logger->post("debug.test", $_SERVER); echo '.'; } }
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 testGetOption() { $logger = new FluentLogger("localhost", 119223); $this->assertEquals(FluentLogger::CONNECTION_TIMEOUT, $logger->getOption("socket_timeout"), "getOptions retunrs unexpected value"); }
/** * {@inheritdoc} */ public function close() { $this->fluentLogger->close(); }
/** * {@inheritDoc} */ public function write(array $record) { $record['level'] = Logger::getLevelName($record['level']); $tag = $record['channel'] . '.' . $record['message']; $this->logger->post($tag, $record); }
<?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);
/** * @inheritdoc */ public function init() { parent::init(); $this->_logger = FluentLogger::open($this->host, $this->port, $this->options); }
<?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"}