Simple logger class for HipChat

1.1.2 2014-09-18 11:54 UTC

This package is not auto-updated.

Last update: 2020-08-03 05:49:18 UTC


PSR-3 compatible logger class which will send you notification to your HipChat room.

Screenshot (taken with Nette Framework's Tracy bridge)



Via composer require vysinsky/hipchat-logger:@dev


Class Vysinsky\HipChat\Logger has some static properties you can use to configure:

  • notifyLevels - Array of levels for which notification (HipChat's popup) is enabled
  • colors - Basic colors setup based on log level. In case of unknown key yellow color will be used

Available bridges

Nette Framework (Tracy)

For Nette there is compiler extension. Just add it to your extensions list in neon configuration:

hipChatLogger: Vysinsky\HipChat\Bridges\Tracy\DI\Extension

And add some configuration:

    accessToken: yourAccessToken
    roomName: test
        - [LoggerFilter, filterAccess]
    linkFactory: [MyLinkFactory::createLink] # Set link factory

Other features


You can now easilly filter messages and decide, whether message should be sent. Filters are simple callbacks which get $level, $message and $context as parameter. Filter return boolean $shouldSend. As soon as any filter returns FALSE execution is stopped.

Example (we don't want to log 404s):

class LoggerFilter 
    function filterAccess($level, $message, $context)
        return $level !== 'access';

Log file link factory

You can set callback factory to Logger, which will create link to log file and send it in message if link is available.

You can set it with calling setLinkToLogFileFactory (only in Vysinsky\HipChat\Bridges\Tracy):

$logger->setLinkToLogFileFactory(function(Vysinsky\HipChat\Bridges\Tracy $logger, $logPath){
	return $logger->extractLogPath($logPath);