Skip to content
This repository was archived by the owner on Dec 16, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Based on https://github.com/pfote/Codeigniter-Monolog, but updating monolog to 1

This library registers Monolog as the PHP error handler to catch all errors and adds support for IntrospectionProcessor for additional meta data.

Supports File (RotatingFileHandler) and New Relic (NewRelicHandler).
Supports File (RotatingFileHandler), New Relic (NewRelicHandler) and HipChat (HipChatHandler).

Installation
------------
Expand Down
10 changes: 9 additions & 1 deletion application/config/monolog.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


/* GENERAL OPTIONS */
$config['handlers'] = array('file', 'new_relic'); // valid handlers are file | new_relic
$config['handlers'] = array('file', 'new_relic', 'hipchat'); // valid handlers are file | new_relic | hipchat
$config['channel'] = ENVIRONMENT; // channel name which appears on each line of log
$config['threshold'] = '4'; // 'ERROR' => '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'
$config['introspection_processor'] = TRUE; // add some meta data such as controller and line number to log messages
Expand All @@ -26,5 +26,13 @@
/* NEW RELIC OPTIONS */
$config['new_relic_app_name'] = 'App Name - ' . ENVIRONMENT;

/* HIPCHAT OPTIONS */
$config['hipchat_app_token'] = ''; //HipChat API Token
$config['hipchat_app_room_id'] = ''; //The room that should be alerted of the message (Id or Name)
$config['hipchat_app_notification_name'] = 'Monolog'; //Name used in the "from" field
$config['hipchat_app_notify'] = false; //Trigger a notification in clients or not
$config['hipchat_app_loglevel'] = Logger::WARNING; //The minimum logging level at which this handler will be triggered


// exclusion list for pesky messages which you may wish to temporarily suppress with strpos() match
$config['exclusion_list'] = array();
10 changes: 10 additions & 0 deletions application/libraries/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Monolog\ErrorHandler;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Handler\NewRelicHandler;
use Monolog\Handler\HipChatHandler;
use Monolog\Processor\IntrospectionProcessor;

/**
Expand Down Expand Up @@ -79,6 +80,15 @@ public function __construct()
$handler = new NewRelicHandler(Logger::ERROR, true, $this->config['new_relic_app_name']);
break;

case 'hipchat':
$handler = new HipChatHandler(
$config['hipchat_app_token'],
$config['hipchat_app_room_id'],
$config['hipchat_app_notification_name'],
$config['hipchat_app_notify'],
$config['hipchat_app_loglevel']);
break;

default:
exit('log handler not supported: ' . $this->config['handler']);
}
Expand Down