示例#1
0
 public static function init($apiKey = null)
 {
     if (is_null(self::$instance)) {
         if (!defined('_DEF_LOGRIVER_API_KEY')) {
             define('_DEF_LOGRIVER_API_KEY', $apiKey);
             require dirname(__FILE__) . '/Global.php';
             // __DIR__ appears only in Php 5.3
         }
         if ($apiKey === null) {
             throw new Exception("apiKey parameter is required");
         } elseif (!is_string($apiKey) || is_string($apiKey) && strlen($apiKey) !== 32) {
             throw new Exception("apiKey parameter is not correct");
         }
         self::$instance = new self($apiKey);
     }
     return self::$instance;
 }
示例#2
0
 public function testFatalError()
 {
     $client = Logriver_Client::init('12345baced3340aa940fc402e652d30d');
     $client->setDebugMode();
     $client->startListener();
     $serialized = exec('php ' . dirname(__FILE__) . '/SimFatalError.php');
     // __DIR__ appears only in Php 5.3
     $model = unserialize($serialized);
     $this->assertEquals($model->type, 5);
     $this->assertEquals(basename($model->file), 'SimFatalError.php');
     $this->assertTrue(is_int($model->line));
     $this->assertTrue(is_double($model->mt));
     $this->assertTrue(is_string($model->m));
     $this->assertTrue(is_double($model->st));
     $this->assertEquals($model->message, 'Call to undefined function functionNotExists()');
     $this->assertEquals($model->ct, 1);
     $this->assertEquals($model->cat, 2);
     $this->assertTrue(is_array($model->ds));
     $this->assertNull($model->t);
     //$this->assertEquals(count($model->t), 1);
     $this->assertNull($model->md);
 }
<?php

ini_set('error_reporting', E_ALL);
ini_set('display_errors', 0);
ini_set('error_log', '/dev/null');
require dirname(__FILE__) . '/../bootstrap52.php';
// __DIR__ appears only in Php 5.3
$client = Logriver_Client::init('12345baced3340aa940fc402e652d30d');
$client->setDebugMode(1);
$client->startListener();
functionNotExists();
示例#4
0
function Logriver_captureException($message)
{
    Logriver_Client::captureException($message);
}