Changeset 732 for trunk/lib


Ignore:
Timestamp:
Aug 8, 2020 10:13:07 PM (4 years ago)
Author:
anonymous
Message:

Update logMsg email

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r726 r732  
    980980        $event_short['url'] = truncate($event_short['url'], 120);
    981981
    982         // Restore original locale.
    983         setlocale(LC_TIME, $locale);
     982        // Email info.
     983        $hostname = ('' != $this->getParam('site_hostname')) ? $this->getParam('site_hostname') : php_uname('n');
     984        $headers = sprintf("From: %s\nX-File: %s\nX-Line: %s", $this->getParam('site_email'), $file, $line);
    984985
    985986        // FILE ACTION
     
    990991
    991992        // EMAIL ACTION
    992         if (false !== $this->getParam('log_email_priority') && $priority <= $this->getParam('log_email_priority') && $send_notifications) {
    993             $hostname = ('' != $this->getParam('site_hostname')) ? $this->getParam('site_hostname') : php_uname('n');
     993        if (false !== $this->getParam('log_email_priority') && $priority <= $this->getParam('log_email_priority') && '' != $this->getParam('log_to_email_address') && $send_notifications) {
    994994            $subject = sprintf('[%s %s] %s', $hostname, $event['type'], mb_substr($event['message'], 0, 64));
    995995            $email_msg = sprintf("A log event of type '%s' occurred on %s\n\n", $event['type'], $hostname);
    996             $headers = 'From: ' . $this->getParam('site_email');
    997996            foreach ($event as $k=>$v) {
    998997                $email_msg .= sprintf("%-16s %s\n", $k, $v);
     
    10041003
    10051004        // SMS ACTION
    1006         if (false !== $this->getParam('log_sms_priority') && $priority <= $this->getParam('log_sms_priority') && $send_notifications) {
    1007             $hostname = ('' != $this->getParam('site_hostname')) ? $this->getParam('site_hostname') : php_uname('n');
    1008             $subject = sprintf('[%s %s]', $hostname, $priority);
     1005        if (false !== $this->getParam('log_sms_priority') && $priority <= $this->getParam('log_sms_priority') && '' != $this->getParam('log_to_sms_address') && $send_notifications) {
     1006            $subject = sprintf('[%s %s]', $hostname, $this->logPriorityToString($priority));
    10091007            $sms_msg = sprintf('%s [%s:%s]', mb_substr($event_short['message'], 0, 64), basename($file), $line);
    1010             $headers = 'From: ' . $this->getParam('site_email');
    10111008            mb_send_mail($this->getParam('log_to_sms_address'), $subject, $sms_msg, $headers);
    10121009        }
     
    10161013            file_put_contents('php://stderr', "[{$event['type']}] [{$event['message']}]\n", FILE_APPEND);
    10171014        }
     1015
     1016        // Restore original locale.
     1017        setlocale(LC_TIME, $locale);
    10181018
    10191019        return true;
Note: See TracChangeset for help on using the changeset viewer.