Exemple #1
0
<?php

namespace LosLog;

class LosZray
{
    public function storeLog($context, &$storage)
    {
        $msg = $context["functionArgs"][0];
        list($usec, $sec) = explode(" ", microtime());
        $date = date("Y-m-d H:i:s", $sec) . substr($usec, 1);
        $storage['LosLog'][] = array('date' => $date, 'message' => $msg);
    }
}
$losStorage = new \LosLog\LosZray();
$loslog = new \ZRayExtension("loslog");
$loslog->setMetadata(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'logo.png'));
$loslog->setEnabledAfter('Zend\\Mvc\\Application::init');
$loslog->traceFunction("LosLog\\Log\\StaticLogger::save", array($losStorage, 'storeLog'), function () {
});
Exemple #2
0
<?php

namespace Bewotec;

require __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Cms.php';
// Create new extension - disabled
$zre = new \ZRayExtension('Bewotec');
$zre->setEnabledAfter('Zend\\Mvc\\Application::init');
$cms = new Cms();
// @TODO: Adjust the class name
$zre->traceFunction('Application\\Controller\\IndexController::indexAction', function ($context, &$storage) {
}, array($cms, 'onLeaveIndexAction'));
// Collect information for the requests
// @TODO: Adjust the class name
//$zre->traceFunction('<ActualClassName>::doRequest',
$zre->traceFunction('Application\\Service\\Remote::doRequest', function ($context, &$storage) {
}, array($cms, 'onLeaveDoRequest'));
// Summarize that information
$zre->traceFunction('Bewotec\\Cms::shutdown', function ($context, &$storage) {
}, array($cms, 'onLeaveShutdown'));
register_shutdown_function(array($cms, 'shutdown'));
$zre->setMetadata(array(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'logo.png')));
                    $obj = $pk->getPermissionObject();
                    if ($obj && (!isset($lastobj) || $lastobj != $obj)) {
                        $storage['customPagePermissions'][] = array('Type' => $obj->getPermissionObjectKeyCategoryHandle(), 'Object' => $obj->getPermissionObjectIdentifier());
                    }
                    $lastobj = $obj;
                }
            }
        }
    }
}
require __DIR__ . '/objects.php';
// Create new extension - disabled
$zre = new \ZRayExtension('concrete5');
$concrete5 = new Zray();
// set additional data such as logo
$zre->setMetadata(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'double_logo.png'));
// start tracing only when 'your_application_initial_method' is called, e.g. 'Mage::run()'
$zre->setEnabledAfter('Concrete\\Core\\Application\\Application::checkPageCache');
// start everything
$zre->traceFunction('Concrete\\Core\\Application\\Application::checkPageCache', array($concrete5, 'start'), function () {
});
// trace config values checked and what their value was
$zre->traceFunction('Illuminate\\Config\\Repository::get', function () {
}, array($concrete5, 'onAfterGetConfigValue'));
// trace blocks
$zre->traceFunction('Concrete\\Core\\Page\\View\\PageView::startRender', array($concrete5, 'onBeforePageRender'), function () {
});
// trace block render time
$zre->traceFunction('Concrete\\Core\\Block\\View\\BlockView::start', array($concrete5, 'onBeforeBlockRender'), function () {
});
$zre->traceFunction('Concrete\\Core\\Block\\View\\BlockView::finishRender', function () {