模块

Log_Syslog
继承自 Log_Writer

Syslog log writer.

package
BootPHP
category
日志
author
Tinsh
copyright
© 2005-2016 Kilofox Studio

该类在 SYSPATH/classes/log/syslog.php 第 12 行声明。

属性

protected string $_ident

The syslog identifier

protected array $_log_levels

Numeric log level to string lookup table.

protected array $_syslog_levels

log levels

方法

public __construct( [ string $ident = string(10) "BootPHPPHP" , int $facility = integer 8 ] ) (在 Log_Syslog 中定义)

Creates a new syslog logger.

参数

  • string $ident = string(10) "BootPHPPHP" - Syslog identifier
  • int $facility = integer 8 - Facility to log to

Tags

  • See - http://us2.php.net/openlog

返回值

  • void

源代码

public function __construct($ident = 'BootPHPPHP', $facility = LOG_USER)
{
	$this->_ident = $ident;
	// Open the connection to syslog
	openlog($this->_ident, LOG_CONS, $facility);
}

public __destruct( ) (在 Log_Syslog 中定义)

Closes the syslog connection

返回值

  • void

源代码

public function __destruct()
{
	// Close connection to syslog
	closelog();
}

public write( array $messages ) (在 Log_Syslog 中定义)

Writes each of the messages into the syslog.

参数

  • array $messages required - Messages

返回值

  • void

源代码

public function write(array $messages)
{
	foreach ($messages as $message)
	{
		syslog($message['level'], $message['body']);
	}
}

final public __toString( ) (在 Log_Writer 中定义)

Allows the writer to have a unique key when stored.

echo $writer;

返回值

  • string

源代码

final public function __toString()
{
	return spl_object_hash($this);
}