Skip to content
This repository was archived by the owner on Dec 16, 2018. It is now read-only.

Commit d274b63

Browse files
author
Steve Thomas
committed
Merge pull request #2 from bluehaoran/master
Add HipChat Integration
2 parents f7d8942 + ac2f121 commit d274b63

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Based on https://github.com/pfote/Codeigniter-Monolog, but updating monolog to 1
77

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

10-
Supports File (RotatingFileHandler) and New Relic (NewRelicHandler).
10+
Supports File (RotatingFileHandler), New Relic (NewRelicHandler) and HipChat (HipChatHandler).
1111

1212
Installation
1313
------------

application/config/monolog.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

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

29+
/* HIPCHAT OPTIONS */
30+
$config['hipchat_app_token'] = ''; //HipChat API Token
31+
$config['hipchat_app_room_id'] = ''; //The room that should be alerted of the message (Id or Name)
32+
$config['hipchat_app_notification_name'] = 'Monolog'; //Name used in the "from" field
33+
$config['hipchat_app_notify'] = false; //Trigger a notification in clients or not
34+
$config['hipchat_app_loglevel'] = Logger::WARNING; //The minimum logging level at which this handler will be triggered
35+
36+
2937
// exclusion list for pesky messages which you may wish to temporarily suppress with strpos() match
3038
$config['exclusion_list'] = array();

application/libraries/Log.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Monolog\ErrorHandler;
1717
use Monolog\Handler\RotatingFileHandler;
1818
use Monolog\Handler\NewRelicHandler;
19+
use Monolog\Handler\HipChatHandler;
1920
use Monolog\Processor\IntrospectionProcessor;
2021

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

83+
case 'hipchat':
84+
$handler = new HipChatHandler(
85+
$config['hipchat_app_token'],
86+
$config['hipchat_app_room_id'],
87+
$config['hipchat_app_notification_name'],
88+
$config['hipchat_app_notify'],
89+
$config['hipchat_app_loglevel']);
90+
break;
91+
8292
default:
8393
exit('log handler not supported: ' . $this->config['handler']);
8494
}

0 commit comments

Comments
 (0)