ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ($persistent)
 Set socket connection to nbe persistent. More...
 
 setConnectionTimeout ($seconds)
 Set connection timeout. More...
 
 setTimeout ($seconds)
 Set write timeout. More...
 
 setWritingTimeout ($seconds)
 Set writing 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...
 
 getWritingTimeout ()
 Get current local writing 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 ()
 

Protected Member Functions

 getDefaultFormatter ()
 Gets the default formatter. More...
 
 write (array $record)
 {} 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)
 
 getResource ()
 
- 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...
 
- Protected Member Functions inherited from Monolog\Handler\AbstractHandler
 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

Definition at line 43 of file FlowdockHandler.php.

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

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  }

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.

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

107  {
108  return json_encode($record['formatted']['flowdock']);
109  }
+ 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.

References $header.

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

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  }
+ Here is the caller graph for this function:

◆ generateDataStream()

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

{}

Parameters
array$record
Returns
string

Definition at line 93 of file FlowdockHandler.php.

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

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

◆ getDefaultFormatter()

Monolog\Handler\FlowdockHandler::getDefaultFormatter ( )
protected

Gets the default formatter.

Returns
FormatterInterface

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
}

Implements Monolog\Handler\HandlerInterface.

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  }

◆ write()

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

{}

Parameters
array$record

Definition at line 80 of file FlowdockHandler.php.

References Monolog\Handler\SocketHandler\closeSocket().

81  {
82  parent::write($record);
83 
84  $this->closeSocket();
85  }
closeSocket()
Close socket, if open.
+ 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: