for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Oqq\Minc\Log\Handler;
use Oqq\Minc\Log\Level;
use Oqq\Minc\Log\Record;
use Oqq\Minc\HipChat\Room as HipChatRoom;
/**
* @author Eric Braun <[email protected]>
*/
class HipChatHandler extends AbstractHandler
{
/** @var HipChatRoom */
protected $room;
/** @var string */
protected $from;
* @param HipChatRoom $room
* @param string $from
* @param int $level
* @param bool $pass
public function __construct(
HipChatRoom $room,
$from,
$level = HandlerInterface::DEFAULT_LEVEL,
$pass = HandlerInterface::DEFAULT_PASS
) {
$this->room = $room;
$this->from = $from;
parent::__construct($level, $pass);
}
* @param Record $record
*
* @return mixed
* @throws \RuntimeException
protected function write(Record $record)
$this->room->send(
$this->getFormattedMessage($record),
$this->from,
$this->getLevelColor($record->getLevel())
);
* @param string $level
* @return string
protected function getLevelColor($level)
if ($level >= Level::ERROR) {
return 'red';
if ($level >= Level::WARNING) {
return 'yellow';
if ($level === Level::DEBUG) {
return 'grey';
return 'green';