perftools / php-profiler

A PHP profiling library based on XHGUI Data Collector
MIT License
147 stars 26 forks source link

Add stack saver #35

Closed glensc closed 4 years ago

glensc commented 4 years ago

Stack saver

Allows saving to multiple handlers. Useful to fall back to file saver if the upload saver failed.

Example config:

    'save.handler' => \Xhgui\Profiler\Profiler::SAVER_STACK,
    'save.handler.stack' => array(
        'savers' => array(
            \Xhgui\Profiler\Profiler::SAVER_UPLOAD,
            \Xhgui\Profiler\Profiler::SAVER_FILE,
        ),
        // if saveAll=false, break the chain on successful save
        'saveAll' => false,
    ),
    // subhandler specific configs
    'save.handler.file' => array(
        'filename' => '/tmp/xhgui.data.jsonl',
    ),
    'save.handler.upload' => array(
        'uri' => 'https://example.com/run/import',
        'timeout' => 3,
        'token' => 'token',
    ),