Example #1
0
function write_error_in_log($errno, $errstr, $errfile, $errline)
{
    global $logger;
    $back_trace = new lmbBacktrace(10, 10);
    $error_str = " error: {$errstr}\nfile: {$errfile}\nline: {$errline}\nbacktrace:" . $back_trace->toString();
    $logger->log($error_str, "ERROR", $errno);
}
 function getTrace()
 {
     $trace_length = 8;
     $offset = 4;
     // getting rid of useless trace elements
     $trace = new lmbBacktrace($trace_length, $offset);
     return $trace->toString();
 }
 protected function _addMessage($key, $operation, $time, $result = true)
 {
     $trace = new lmbBacktrace($trace_length = 8, $offset = 4);
     $this->messages[] = array('key' => $key, 'operation' => $operation, 'result' => $result, 'trace' => $trace->toString(), 'time' => $time);
     if ($this->logger && $this->OPERATION_GET === $operation) {
         if ($result) {
             $this->logger->logHit($this->cache_name);
         } else {
             $this->logger->logMiss($this->cache_name);
         }
     }
 }
Example #4
0
function lmb_autoload($name)
{
    if (isset($_ENV['LIMB_LAZY_CLASS_PATHS'][$name])) {
        $file_path = $_ENV['LIMB_LAZY_CLASS_PATHS'][$name];
        //is it safe to use include here instead of include_once?
        if (!(include_once $file_path)) {
            $message = "Could not include source file '{$file_path}'";
            if (class_exists('lmbException') && class_exists('lmbBacktrace')) {
                $trace = new lmbBacktrace(10, 1);
                throw new lmbException($message, array('trace' => $trace->toString()));
            } else {
                throw new Exception($message);
            }
        }
    }
}
 function testCreate()
 {
     $backtrace = new lmbBacktrace();
     $backtrace2 = lmbBacktrace::create(null, null, $backtrace->get());
     $this->assertEqual($backtrace, $backtrace2);
 }