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

Sends notifications through the Flowdock push API. More...

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

Public Member Functions

 __construct ($apiToken, $level=Logger::DEBUG, $bubble=true)
 
 setFormatter (FormatterInterface $formatter)
 {{Sets the formatter.
Parameters
FormatterInterface$formatter
Returns
self
}} More...
 
- Public Member Functions inherited from Monolog\Handler\SocketHandler
 __construct ($connectionString, $level=Logger::DEBUG, $bubble=true)
 
 close ()
 We will not close a PersistentSocket instance so it can be reused in other requests. More...
 
 closeSocket ()
 Close socket, if open. More...
 
 setPersistent ($boolean)
 Set socket connection to nbe persistent. More...
 
 setConnectionTimeout ($seconds)
 Set connection timeout. More...
 
 setTimeout ($seconds)
 Set write timeout. More...
 
 getConnectionString ()
 Get current connection string. More...
 
 isPersistent ()
 Get persistent setting. More...
 
 getConnectionTimeout ()
 Get current connection timeout setting. More...
 
 getTimeout ()
 Get current in-transfer timeout. More...
 
 isConnected ()
 Check to see if the socket is currently available. 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...
 

Protected Member Functions

 getDefaultFormatter ()
 Gets the default formatter. More...
 
 write (array $record)
 {Connect (if necessary) and write to the socket.
Parameters
array$record
Exceptions

UnexpectedValueException

Exceptions

RuntimeException} More...

 
 generateDataStream ($record)
 {} More...
 
- Protected Member Functions inherited from Monolog\Handler\SocketHandler
 write (array $record)
 Connect (if necessary) and write to the socket. More...
 
 pfsockopen ()
 Wrapper to allow mocking. More...
 
 fsockopen ()
 Wrapper to allow mocking. More...
 
 streamSetTimeout ()
 Wrapper to allow mocking. More...
 
 fwrite ($data)
 Wrapper to allow mocking. More...
 
 streamGetMetadata ()
 Wrapper to allow mocking. More...
 
 generateDataStream ($record)
 
- 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...
 

Protected Attributes

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

Private Member Functions

 buildContent ($record)
 Builds the body of API call. More...
 
 buildHeader ($content)
 Builds the header of the API Call. More...
 

Detailed Description

Sends notifications through the Flowdock push API.

This must be configured with a FlowdockFormatter instance via setFormatter()

Notes: API token - Flowdock API token

Author
Dominik Liebler liebl.nosp@m.er.d.nosp@m.omini.nosp@m.k@gm.nosp@m.ail.c.nosp@m.om
See also
https://www.flowdock.com/api/push

Definition at line 29 of file FlowdockHandler.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Handler\FlowdockHandler::__construct (   $apiToken,
  $level = Logger::DEBUG,
  $bubble = true 
)
Parameters
string$apiToken
bool | int$levelThe minimum logging level at which this handler will be triggered
bool$bubbleWhether the messages that are handled can bubble up the stack or not
Exceptions
MissingExtensionExceptionif OpenSSL is missing

Reimplemented from Monolog\Handler\SocketHandler.

Definition at line 43 of file FlowdockHandler.php.

44 {
45 if (!extension_loaded('openssl')) {
46 throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler');
47 }
48
49 parent::__construct('ssl://api.flowdock.com:443', $level, $bubble);
50 $this->apiToken = $apiToken;
51 }

References Monolog\Handler\FlowdockHandler\$apiToken, Monolog\Handler\AbstractHandler\$bubble, and Monolog\Handler\AbstractHandler\$level.

Member Function Documentation

◆ buildContent()

Monolog\Handler\FlowdockHandler::buildContent (   $record)
private

Builds the body of API call.

Parameters
array$record
Returns
string

Definition at line 106 of file FlowdockHandler.php.

107 {
108 return json_encode($record['formatted']['flowdock']);
109 }

Referenced by Monolog\Handler\FlowdockHandler\generateDataStream().

+ Here is the caller graph for this function:

◆ buildHeader()

Monolog\Handler\FlowdockHandler::buildHeader (   $content)
private

Builds the header of the API Call.

Parameters
string$content
Returns
string

Definition at line 117 of file FlowdockHandler.php.

118 {
119 $header = "POST /v1/messages/team_inbox/" . $this->apiToken . " HTTP/1.1\r\n";
120 $header .= "Host: api.flowdock.com\r\n";
121 $header .= "Content-Type: application/json\r\n";
122 $header .= "Content-Length: " . strlen($content) . "\r\n";
123 $header .= "\r\n";
124
125 return $header;
126 }
$header

References $header.

Referenced by Monolog\Handler\FlowdockHandler\generateDataStream().

+ Here is the caller graph for this function:

◆ generateDataStream()

Monolog\Handler\FlowdockHandler::generateDataStream (   $record)
protected

{}

Parameters
array$record
Returns
string

Reimplemented from Monolog\Handler\SocketHandler.

Definition at line 93 of file FlowdockHandler.php.

94 {
95 $content = $this->buildContent($record);
96
97 return $this->buildHeader($content) . $content;
98 }
buildHeader($content)
Builds the header of the API Call.
buildContent($record)
Builds the body of API call.

References Monolog\Handler\FlowdockHandler\buildContent(), and Monolog\Handler\FlowdockHandler\buildHeader().

+ Here is the call graph for this function:

◆ getDefaultFormatter()

Monolog\Handler\FlowdockHandler::getDefaultFormatter ( )
protected

Gets the default formatter.

Returns
FormatterInterface

Reimplemented from Monolog\Handler\AbstractHandler.

Definition at line 70 of file FlowdockHandler.php.

71 {
72 throw new \InvalidArgumentException('The FlowdockHandler must be configured (via setFormatter) with an instance of Monolog\Formatter\FlowdockFormatter to function correctly');
73 }

◆ setFormatter()

Monolog\Handler\FlowdockHandler::setFormatter ( FormatterInterface  $formatter)

{{Sets the formatter.

Parameters
FormatterInterface$formatter
Returns
self
}}

Reimplemented from Monolog\Handler\AbstractHandler.

Definition at line 56 of file FlowdockHandler.php.

57 {
58 if (!$formatter instanceof FlowdockFormatter) {
59 throw new \InvalidArgumentException('The FlowdockHandler requires an instance of Monolog\Formatter\FlowdockFormatter to function correctly');
60 }
61
62 return parent::setFormatter($formatter);
63 }

References Monolog\Handler\AbstractHandler\$formatter.

◆ write()

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

{Connect (if necessary) and write to the socket.

Parameters
array$record
Exceptions

UnexpectedValueException

Exceptions

RuntimeException}

Parameters
array$record

Reimplemented from Monolog\Handler\SocketHandler.

Definition at line 80 of file FlowdockHandler.php.

81 {
82 parent::write($record);
83
84 $this->closeSocket();
85 }
closeSocket()
Close socket, if open.

References Monolog\Handler\SocketHandler\closeSocket().

+ Here is the call graph for this function:

Field Documentation

◆ $apiToken

Monolog\Handler\FlowdockHandler::$apiToken
protected

Definition at line 34 of file FlowdockHandler.php.

Referenced by Monolog\Handler\FlowdockHandler\__construct().


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