Esempio n. 1
0
function ToLog($msg, $path = '')
{
    global $g_config;
    $path = empty($path) ? $g_config['logPath'] : $path;
    $logger = FileLogger::Create($path);
    $logger->Message($msg);
}
Esempio n. 2
0
 public static function DbSimpleError($message, $info)
 {
     global $g_config;
     if (!error_reporting()) {
         return;
     }
     if ($info['query'] == "mysql_connect()") {
         exit("Can not connect to database(s)");
         // Не работаем дальше с кодом
     }
     static $fileLogger = NULL;
     if (is_null($fileLogger)) {
         $fileLogger = FileLogger::Create($g_config['dbSimple']['dbLogFile']);
     }
     $fileLogger->Error(PHP_EOL . "\tquery: " . $info['query'] . PHP_EOL . "\tmessage: " . $info['message'] . PHP_EOL . "\tcode: " . $info['code'] . PHP_EOL . "\tcontext: " . $info['context'] . PHP_EOL . PHP_EOL);
 }
 protected function _notifyText($subject, $body)
 {
     global $g_config;
     // Подготовка сообщения ошибки
     $msg = PHP_EOL . "Text notification:" . PHP_EOL . "\tsubject: {$subject}" . PHP_EOL . "\t{$body}" . PHP_EOL;
     // Запись ошибки в лог-файл
     $path = $g_config['logErrors']['logFile'];
     $fileLogger = FileLogger::Create($path);
     $fileLogger->Error($msg);
     // Вывод ошибки на экран
     if ($g_config['phpIni']['display_errors']) {
         echo "<pre>{$msg}</pre>";
     } else {
         IncludeCom('500');
     }
 }