本文整理汇总了PHP中Zend_Log_Writer_Stream::shutdown方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Log_Writer_Stream::shutdown方法的具体用法?PHP Zend_Log_Writer_Stream::shutdown怎么用?PHP Zend_Log_Writer_Stream::shutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Log_Writer_Stream
的用法示例。
在下文中一共展示了Zend_Log_Writer_Stream::shutdown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shutdown
/**
* Close the stream resource.
*
* @return void
*/
public function shutdown()
{
try {
$this->_writeRepeated();
} catch (Zend_Log_Exception $e) {
// No problem if it should fail, don't want to break the program
}
// Close the file
parent::shutdown();
}
示例2: toLog
public static function toLog($message, $level = Zend_Log::INFO, $file = 'system_log.txt')
{
$filename = implode(DIRECTORY_SEPARATOR, array(RM_Environment::getConnector()->getCorePath(), 'userdata', 'logs', $file));
if (is_file($filename) == false) {
return false;
}
if (is_writable($filename) == false) {
return false;
}
try {
$stream = new Zend_Log_Writer_Stream($filename);
$logger = new RM_Log($stream);
$logger->log($message, $level);
$stream->shutdown();
return true;
} catch (Exception $e) {
return false;
}
}
示例3: testShutdownClosesStreamResource
public function testShutdownClosesStreamResource()
{
$writer = new Zend_Log_Writer_Stream('php://memory', 'w+');
$writer->write(array('message' => 'this write should succeed'));
$writer->shutdown();
try {
$writer->write(array('message' => 'this write should fail'));
$this->fail();
} catch (Exception $e) {
$this->assertTrue($e instanceof Zend_Log_Exception);
$this->assertRegExp('/unable to write/i', $e->getMessage());
}
}