ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Monolog\Handler\FirePHPHandler Class Reference

Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol. More...

+ Inheritance diagram for Monolog\Handler\FirePHPHandler:
+ Collaboration diagram for Monolog\Handler\FirePHPHandler:

Public Member Functions

 __get ($property)
 BC getter for the sendHeaders property that has been made static. More...
 
 __set ($property, $value)
 BC setter for the sendHeaders property that has been made static. More...
 
- Public Member Functions inherited from Monolog\Handler\AbstractProcessingHandler
 handle (array $record)
 {Handles a record.All records may be passed to this method, and the handler should discard those that it does not want to handle.The return value of this function controls the bubbling process of the handler stack. Unless the bubbling is interrupted (by returning true), the Logger class will keep on calling further handlers in the stack with a given log record.
Parameters
array$recordThe record to handle
Returns
Boolean true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
} More...
 
- Public Member Functions inherited from Monolog\Handler\AbstractHandler
 __construct ($level=Logger::DEBUG, $bubble=true)
 
 isHandling (array $record)
 {Checks whether the given record will be handled by this handler.This is mostly done for performance reasons, to avoid calling processors for nothing.Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.
Parameters
array$recordPartial log record containing only a level key
Returns
Boolean
} More...
 
 handleBatch (array $records)
 {Handles a set of records at once.
Parameters
array$recordsThe records to handle (an array of record arrays)
} More...
 
 close ()
 Closes the handler. More...
 
 pushProcessor ($callback)
 {Adds a processor in the stack.
Parameters
callable$callback
Returns
self
} More...
 
 popProcessor ()
 {Removes the processor on top of the stack and returns it.
Returns
callable
} More...
 
 setFormatter (FormatterInterface $formatter)
 {Sets the formatter.
Parameters
FormatterInterface$formatter
Returns
self
} More...
 
 getFormatter ()
 {Gets the formatter.
Returns
FormatterInterface
} More...
 
 setLevel ($level)
 Sets minimum logging level at which this handler will be triggered. More...
 
 getLevel ()
 Gets minimum logging level at which this handler will be triggered. More...
 
 setBubble ($bubble)
 Sets the bubbling behavior. More...
 
 getBubble ()
 Gets the bubbling behavior. More...
 
 __destruct ()
 
 isHandling (array $record)
 Checks whether the given record will be handled by this handler. More...
 
 handle (array $record)
 Handles a record. More...
 
 handleBatch (array $records)
 Handles a set of records at once. More...
 
 pushProcessor ($callback)
 Adds a processor in the stack. More...
 
 popProcessor ()
 Removes the processor on top of the stack and returns it. More...
 
 setFormatter (FormatterInterface $formatter)
 Sets the formatter. More...
 
 getFormatter ()
 Gets the formatter. More...
 

Data Fields

const PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'
 WildFire JSON header message format. More...
 
const STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'
 FirePHP structure for parsing messages & their presentation. More...
 
const PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3'
 Must reference a "known" plugin, otherwise headers won't display in FirePHP. More...
 
const HEADER_PREFIX = 'X-Wf'
 Header prefix for Wildfire to recognize & parse headers. More...
 

Protected Member Functions

 createHeader (array $meta, $message)
 Base header creation function used by init headers & record headers. More...
 
 createRecordHeader (array $record)
 Creates message header from record. More...
 
 getDefaultFormatter ()
 Gets the default formatter.
Returns
FormatterInterface
More...
 
 getInitHeaders ()
 Wildfire initialization headers to enable message parsing. More...
 
 sendHeader ($header, $content)
 Send header string to the client. More...
 
 write (array $record)
 Creates & sends header for a record, ensuring init headers have been sent prior. More...
 
 headersAccepted ()
 Verifies if the headers are accepted by the current user agent. More...
 
- Protected Member Functions inherited from Monolog\Handler\AbstractProcessingHandler
 write (array $record)
 Writes the record down to the log of the implementing handler. More...
 
 processRecord (array $record)
 Processes a record. More...
 
 getDefaultFormatter ()
 Gets the default formatter. More...
 

Static Protected Attributes

static $initialized = false
 Whether or not Wildfire vendor-specific headers have been generated & sent yet. More...
 
static $messageIndex = 1
 
static $sendHeaders = true
 

Additional Inherited Members

- Protected Attributes inherited from Monolog\Handler\AbstractHandler
 $level = Logger::DEBUG
 
 $bubble = true
 
 $formatter
 
 $processors = array()
 

Detailed Description

Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol.

Author
Eric Clemmons (@ericclemmons) eric@.nosp@m.uxdr.nosp@m.iven..nosp@m.com

Definition at line 21 of file FirePHPHandler.php.

Member Function Documentation

◆ __get()

Monolog\Handler\FirePHPHandler::__get (   $property)

BC getter for the sendHeaders property that has been made static.

Definition at line 175 of file FirePHPHandler.php.

176 {
177 if ('sendHeaders' !== $property) {
178 throw new \InvalidArgumentException('Undefined property '.$property);
179 }
180
181 return static::$sendHeaders;
182 }

◆ __set()

Monolog\Handler\FirePHPHandler::__set (   $property,
  $value 
)

BC setter for the sendHeaders property that has been made static.

Definition at line 187 of file FirePHPHandler.php.

188 {
189 if ('sendHeaders' !== $property) {
190 throw new \InvalidArgumentException('Undefined property '.$property);
191 }
192
193 static::$sendHeaders = $value;
194 }

◆ createHeader()

Monolog\Handler\FirePHPHandler::createHeader ( array  $meta,
  $message 
)
protected

Base header creation function used by init headers & record headers.

Parameters
array$metaWildfire Plugin, Protocol & Structure Indexes
string$messageLog message
Returns
array Complete header string ready for the client as key and message as value

Definition at line 63 of file FirePHPHandler.php.

64 {
65 $header = sprintf('%s-%s', self::HEADER_PREFIX, join('-', $meta));
66
67 return array($header => $message);
68 }
$header

References $header.

Referenced by Monolog\Handler\FirePHPHandler\createRecordHeader(), and Monolog\Handler\FirePHPHandler\getInitHeaders().

+ Here is the caller graph for this function:

◆ createRecordHeader()

Monolog\Handler\FirePHPHandler::createRecordHeader ( array  $record)
protected

Creates message header from record.

See also
createHeader()
Parameters
array$record
Returns
string

Definition at line 77 of file FirePHPHandler.php.

78 {
79 // Wildfire is extensible to support multiple protocols & plugins in a single request,
80 // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake.
81 return $this->createHeader(
82 array(1, 1, 1, self::$messageIndex++),
83 $record['formatted']
84 );
85 }
createHeader(array $meta, $message)
Base header creation function used by init headers & record headers.

References Monolog\Handler\FirePHPHandler\createHeader().

Referenced by Monolog\Handler\FirePHPHandler\write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultFormatter()

Monolog\Handler\FirePHPHandler::getDefaultFormatter ( )
protected

Gets the default formatter.

Returns
FormatterInterface

Reimplemented from Monolog\Handler\AbstractHandler.

Definition at line 90 of file FirePHPHandler.php.

91 {
92 return new WildfireFormatter();
93 }

◆ getInitHeaders()

Monolog\Handler\FirePHPHandler::getInitHeaders ( )
protected

Wildfire initialization headers to enable message parsing.

See also
createHeader()
sendHeader()
Returns
array

Definition at line 102 of file FirePHPHandler.php.

103 {
104 // Initial payload consists of required headers for Wildfire
105 return array_merge(
106 $this->createHeader(array('Protocol', 1), self::PROTOCOL_URI),
107 $this->createHeader(array(1, 'Structure', 1), self::STRUCTURE_URI),
108 $this->createHeader(array(1, 'Plugin', 1), self::PLUGIN_URI)
109 );
110 }

References Monolog\Handler\FirePHPHandler\createHeader().

Referenced by Monolog\Handler\FirePHPHandler\write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ headersAccepted()

Monolog\Handler\FirePHPHandler::headersAccepted ( )
protected

Verifies if the headers are accepted by the current user agent.

Returns
Boolean

Definition at line 163 of file FirePHPHandler.php.

164 {
165 if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) {
166 return true;
167 }
168
169 return isset($_SERVER['HTTP_X_FIREPHP_VERSION']);
170 }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER.

Referenced by Monolog\Handler\FirePHPHandler\write().

+ Here is the caller graph for this function:

◆ sendHeader()

Monolog\Handler\FirePHPHandler::sendHeader (   $header,
  $content 
)
protected

Send header string to the client.

Parameters
string$header
string$content

Reimplemented in Monolog\Handler\TestFirePHPHandler.

Definition at line 118 of file FirePHPHandler.php.

119 {
120 if (!headers_sent() && self::$sendHeaders) {
121 header(sprintf('%s: %s', $header, $content));
122 }
123 }

References $header.

Referenced by Monolog\Handler\FirePHPHandler\write().

+ Here is the caller graph for this function:

◆ write()

Monolog\Handler\FirePHPHandler::write ( array  $record)
protected

Creates & sends header for a record, ensuring init headers have been sent prior.

See also
sendHeader()
sendInitHeaders()
Parameters
array$record

Reimplemented from Monolog\Handler\AbstractProcessingHandler.

Definition at line 132 of file FirePHPHandler.php.

133 {
134 if (!self::$sendHeaders) {
135 return;
136 }
137
138 // WildFire-specific headers must be sent prior to any messages
139 if (!self::$initialized) {
140 self::$initialized = true;
141
142 self::$sendHeaders = $this->headersAccepted();
143 if (!self::$sendHeaders) {
144 return;
145 }
146
147 foreach ($this->getInitHeaders() as $header => $content) {
148 $this->sendHeader($header, $content);
149 }
150 }
151
152 $header = $this->createRecordHeader($record);
153 if (trim(current($header)) !== '') {
154 $this->sendHeader(key($header), current($header));
155 }
156 }
headersAccepted()
Verifies if the headers are accepted by the current user agent.
createRecordHeader(array $record)
Creates message header from record.
sendHeader($header, $content)
Send header string to the client.
getInitHeaders()
Wildfire initialization headers to enable message parsing.

References $header, Monolog\Handler\FirePHPHandler\createRecordHeader(), Monolog\Handler\FirePHPHandler\getInitHeaders(), Monolog\Handler\FirePHPHandler\headersAccepted(), and Monolog\Handler\FirePHPHandler\sendHeader().

+ Here is the call graph for this function:

Field Documentation

◆ $initialized

Monolog\Handler\FirePHPHandler::$initialized = false
staticprotected

Whether or not Wildfire vendor-specific headers have been generated & sent yet.

Definition at line 46 of file FirePHPHandler.php.

◆ $messageIndex

Monolog\Handler\FirePHPHandler::$messageIndex = 1
staticprotected

Definition at line 52 of file FirePHPHandler.php.

◆ $sendHeaders

Monolog\Handler\FirePHPHandler::$sendHeaders = true
staticprotected

Definition at line 54 of file FirePHPHandler.php.

◆ HEADER_PREFIX

const Monolog\Handler\FirePHPHandler::HEADER_PREFIX = 'X-Wf'

Header prefix for Wildfire to recognize & parse headers.

Definition at line 41 of file FirePHPHandler.php.

◆ PLUGIN_URI

const Monolog\Handler\FirePHPHandler::PLUGIN_URI = 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3'

Must reference a "known" plugin, otherwise headers won't display in FirePHP.

Definition at line 36 of file FirePHPHandler.php.

◆ PROTOCOL_URI

const Monolog\Handler\FirePHPHandler::PROTOCOL_URI = 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2'

WildFire JSON header message format.

Definition at line 26 of file FirePHPHandler.php.

◆ STRUCTURE_URI

const Monolog\Handler\FirePHPHandler::STRUCTURE_URI = 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'

FirePHP structure for parsing messages & their presentation.

Definition at line 31 of file FirePHPHandler.php.


The documentation for this class was generated from the following file: