PHP 클래스 lithium\analysis\logger\adapter\FirePhp

This allows you to inspect native PHP values and objects inside the FireBug console. Because this adapter interacts directly with the Response object, some additional code is required to use it. The simplest way to achieve this is to add a filter to the Dispatcher. For example, the following can be placed in a bootstrap file: {{{ use lithium\action\Dispatcher; use lithium\analysis\Logger; Logger::config(array( 'default' => array('adapter' => 'FirePhp') )); Dispatcher::applyFilter('_call', function($self, $params, $chain) { if (isset($params['callable']->response)) { Logger::adapter('default')->bind($params['callable']->response); } return $chain->next($self, $params, $chain); }); }}} This will cause the message and other debug settings added to the header of the response, where FirePHP is able to locate and print it accordingly. As this adapter implements the protocol specification directly, you don't need another vendor library to use it. Now, in you can use the logger in your application code (like controllers, views and models). {{{ class PagesController extends \lithium\action\Controller { public function view() { ... Logger::error("Something bad happened!"); ... } } }}} Because this adapter also has a queue implemented, it is possible to log messages even when the Response object is not yet generated. When it gets generated (and bound), all queued messages get flushed instantly. Because FirePHP is not a conventional logging destination like a file or a database, you can pass everything (except resources) to the logger and inspect it further in FirePHP. In fact, every message that is passed will be encoded via json_encode(), so check out this built-in method for more information on how your message will be encoded. {{{ Logger::debug(array('debug' => 'me)); Logger::debug(new \lithium\action\Response()); }}}
또한 보기: lithium\action\Response
또한 보기: lithium\net\http\Message::headers()
상속: extends lithium\core\Object
파일 보기 프로젝트 열기: unionofrad/lithium

보호된 프로퍼티들

프로퍼티 타입 설명
$_counter integer This self-incrementing counter allows the user to log more than one message per request.
$_headers array These headers are specified by FirePHP and get added as headers to the response.
$_levels array This is a mapping table that maps Lithium log levels to FirePHP log levels as they do not correlate directly and FirePHP only accepts a distinct set.
$_queue Contains messages that have been written to the log before the bind() call.
$_response Holds the response object where the headers will be inserted.

공개 메소드들

메소드 설명
bind ( object $response ) : void Binds the response object to the logger and sets the required Wildfire protocol headers.
write ( string $priority, string $message ) : boolean Appends a log message to the response header for FirePHP.

보호된 메소드들

메소드 설명
_format ( string $type, string $message ) : array Generates a string representation of the type and message, suitable for FirePHP.
_write ( array $message ) : array | void Helper method that writes the message to the header of a bound Response object. If no Response object is bound when this method is called, it is stored in a message queue.

메소드 상세

_format() 보호된 메소드

Generates a string representation of the type and message, suitable for FirePHP.
protected _format ( string $type, string $message ) : array
$type string Represents the message priority.
$message string Contains the actual message to store.
리턴 array Returns the encoded string representations of the priority and message, in the `'key'` and `'content'` keys, respectively.

_write() 보호된 메소드

Helper method that writes the message to the header of a bound Response object. If no Response object is bound when this method is called, it is stored in a message queue.
또한 보기: lithium\analysis\logger\adapter\FirePhp::_format()
protected _write ( array $message ) : array | void
$message array A message containing the key and the content to store.
리턴 array | void The queued message when no `Response` object was bound.

bind() 공개 메소드

Binds the response object to the logger and sets the required Wildfire protocol headers.
public bind ( object $response ) : void
$response object An instance of a response object (usually `lithium\action\Response`) with HTTP request information.
리턴 void

write() 공개 메소드

Appends a log message to the response header for FirePHP.
public write ( string $priority, string $message ) : boolean
$priority string Represents the message priority.
$message string Contains the actual message to store.
리턴 boolean Always returns `true`. Note that in order for message-writing to take effect, the adapter must be bound to the `Response` object instance associated with the current request. See the `bind()` method.

프로퍼티 상세

$_counter 보호되어 있는 프로퍼티

This self-incrementing counter allows the user to log more than one message per request.
protected int $_counter
리턴 integer

$_headers 보호되어 있는 프로퍼티

These headers are specified by FirePHP and get added as headers to the response.
protected array $_headers
리턴 array

$_levels 보호되어 있는 프로퍼티

This is a mapping table that maps Lithium log levels to FirePHP log levels as they do not correlate directly and FirePHP only accepts a distinct set.
protected array $_levels
리턴 array

$_queue 보호되어 있는 프로퍼티

Contains messages that have been written to the log before the bind() call.
protected $_queue

$_response 보호되어 있는 프로퍼티

Holds the response object where the headers will be inserted.
protected $_response