File: observer_mail.php

package info (click to toggle)
php-log 1.10.0-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 404 kB
  • ctags: 592
  • sloc: php: 1,822; xml: 237; sql: 8; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 655 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

require_once 'Log/observer.php';

class Log_observer_mail extends Log_observer
{
    var $_to = '';
    var $_subject = '';
    var $_pattern = '';

    function Log_observer_mail($priority, $conf)
    {
        /* Call the base class constructor. */
        $this->Log_observer($priority);

        /* Configure the observer. */
        $this->_to = $conf['to'];
        $this->_subject = $conf['subject'];
        $this->_pattern = $conf['pattern'];
    }

    function notify($event)
    {
        if (preg_match($this->_pattern, $event['message']) != 0) {
            mail($this->_to, $this->_subject, $event['message']);
        }
    }
}

?>