Asf_Log_Adapter_File::flushBuffer

刷新缓冲区所有内容, 它不会关闭文件描述符


Description

public function flushBuffer(void)

当 asf.use_lcache = 1 时, 代表开启buffer缓冲区功能

当 asf.use_lcache = 1 时, PHP脚本正常执行结束会自行刷新buffer缓冲区

Return Values

成功返回 true, 失败返回 false

Examples

Example #1 Commonly used in cli mode

<?php
define('LOG_PATH', '/data/logs/');
ini_set('asf.use_lcache', 1);

$logger = new Asf_Log_Adapter_File('A-dd_log', LOG_PATH);

$i = 0;
while ($i < 10) {
    var_dump($logger->info('A-dd_log xxxxx' . time()));
    $i++;

    sleep(3);

    if ($i == 5) {
        $logger->flushBuffer();
    }
}