php8.5
Home/ Manual/ seaslog / seaslog/ SeasLog::flushBuffer

SeasLog::flushBuffer

PHP function Edit on GitHub ✎

(PECL seaslog >=1.0.0)

Flush logs buffer, dump to appender file, or send to remote api with tcp/udp

Description

SeasLog::flushBuffer(): bool

Flush logs buffer by seaslog.appender: dump to file, or send to remote api with tcp/udp.

Parameters Parameters

Return Values

Return TRUE on flush buffer success, FALSE on failure.

Examples

SeasLog::flushBuffer() example

php
<?php

SeasLog::info('info log');
SeasLog::debug('debug log');
var_dump(SeasLog::getBuffer());
var_dump(SeasLog::flushBuffer());
var_dump(SeasLog::getBuffer());

?>

The above example will output something similar to:

output
array(1) {
  ["/var/log/www/default/20180707.log"]=>
  array(2) {
    [0]=>
    string(79) "2018-07-07 10:47:58 | INFO | 71910 | 5b4029ded6009 | 1530931678.877 | info log
"
    [1]=>
    string(81) "2018-07-07 10:47:58 | DEBUG | 71910 | 5b4029ded6009 | 1530931678.877 | debug log
"
  }
}
bool(true)
array(0) {
}

See Also

Source: reference/seaslog/seaslog/flushbuffer.xml · from the official PHP manual (php/doc-en)