Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

\Phalcon\Logger\Adapter\File options

File adapter constructor accepts the second argument and expect to receive an array of options:

/**
 * \Phalcon\Logger\Adapter\File constructor
 *
 * @param string $name
 * @param array $options
 */
public function __construct($name, $options=null){
}

What they are? Is there any way to flush the log file before each time the adapter is created?



1.2k
Accepted
answer

The only option (so far) is 'mode' — this is file open mode (ie, "a", "w") which is passed to fopen(); if 'mode' is not supplied, 'ab' is used by default.

As for flushing — do you mean to flush the data after every fwrite() to the log file?

Thanks!

As for flushing — do you mean to flush the data after every fwrite() to the log file? It was miss print, I meant truncate!

Just pass array('mode' => 'w') in $options.