Exemplo n.º 1
0
 private function __construct($fPath, $flgAppendData = true)
 {
     $this->fPath = $fPath;
     $dirs = dirname($fPath);
     if ($dirs) {
         FileSys::MakeDir($dirs);
     }
     if (!$flgAppendData) {
         fclose(fopen($fPath, 'a+'));
         $this->fHandle = fopen($fPath, 'r+');
         ftruncate($this->fHandle, 0);
     } else {
         if (file_exists($fPath)) {
             if (filesize($fPath) >= self::MAXSIZE_LOGFILE) {
                 if (self::FLG_CREATE_ARCHIVE) {
                     rename($fPath, $fPath . '-archive[' . date('Y-m-d') . ']');
                 }
                 fclose(fopen($fPath, 'a+'));
                 $this->fHandle = fopen($fPath, 'r+');
                 ftruncate($this->fHandle, 0);
             } else {
                 $this->fHandle = fopen($fPath, 'a+');
             }
         } else {
             $this->fHandle = fopen($fPath, 'a+');
         }
     }
     $this->time = microtime(true);
     $this->aLog = array();
 }
Exemplo n.º 2
0
 private function DebugErrorHook()
 {
     global $g_config;
     static $errorListner = NULL;
     $path = dirname(__FILE__) . '/Debug/ErrorHook/';
     require_once $path . 'Listener.php';
     require_once $path . 'Catcher.php';
     require_once $path . 'INotifier.php';
     require_once $path . 'Util.php';
     require_once $path . 'TextNotifier.php';
     require_once $path . 'MailNotifier.php';
     require_once $path . 'RemoveDupsWrapper.php';
     require_once $path . 'my/MyDebug_ErrorHook_TextNotifier.php';
     $cfgLog = $g_config['logErrors'];
     FileSys::MakeDir(dirname($cfgLog['repeatTmp']));
     $errorListner = new Debug_ErrorHook_Listener();
     $errorListner->addNotifier(new MyDebug_ErrorHook_TextNotifier(MyDebug_ErrorHook_TextNotifier::LOG_ALL));
     if (!empty($cfgLog['email'])) {
         $errorListner->addNotifier(new Debug_ErrorHook_RemoveDupsWrapper(new Debug_ErrorHook_MailNotifier($cfgLog['email'], Debug_ErrorHook_TextNotifier::LOG_ALL), $cfgLog['repeatTmp'] . "/email/", $cfgLog['emailTimeRepeat']));
     }
 }