Beispiel #1
0
 /**
  * Init debug system
  * @deprecated
  * @see X_Debug::init()
  * @param string $path
  */
 public static function initDebug($path)
 {
     X_Debug::init($path);
 }
 protected function _initDebug()
 {
     $this->bootstrap('configs');
     $configs = $this->getResource('configs');
     if ($configs instanceof Zend_Config) {
         try {
             if ($configs->general->debug->enabled) {
                 // init debug system:
                 // config default:
                 //		/tmp/vlcShares.debug.log
                 //		log none
                 $debugPath = sys_get_temp_dir() . '/vlcShares.debug.log';
                 if ($configs->general->debug->path != null && trim($configs->general->debug->path) != '') {
                     $debugPath = $configs->general->debug->get('path', sys_get_temp_dir()) . '/vlcShares.debug.log';
                 }
                 X_Debug::init($debugPath, (int) $configs->general->debug->level);
             }
         } catch (Exception $e) {
             // no init
         }
     }
 }
 /**
  * Create a new thread if $threadId is not already running
  * 
  * @param string $threadId
  * @return X_Threads_Thread_Info|X_Threads_Thread
  */
 public function newThread($threadId)
 {
     $thread = $this->getMonitor()->getThread($threadId);
     if ($thread->getState() == X_Threads_Thread_Info::STOPPED) {
         // create a new thread and return it
         $thread = new X_Threads_Thread($threadId, $this);
         if (!$this->isLogger()) {
             $thread->setLogger(new X_Threads_Logger_Null());
         } else {
             $thread->setLogger(new X_Threads_Logger_File("vlcShares.thread-{$threadId}.log", X_Debug::getLogPath()));
             // redirect standard debug too if enabled
             if (X_Debug::isEnabled()) {
                 X_Debug::i("Forking debug log to {" . X_Debug::getLogPath() . "/vlcShares.thread-{$threadId}.log");
                 X_Debug::init(X_Debug::getLogPath() . "/vlcShares.thread-{$threadId}.log", X_Debug::getLevel());
             }
         }
     }
     return $thread;
 }
 public function log($msg)
 {
     if ($this->logger == null) {
         // initialize default logger
         $this->setLogger(new X_Threads_Logger_File("vlcShares.thread-{$this->getId()}.log", sys_get_temp_dir()));
         // redirect standard debug too if enabled
         if (X_Debug::isEnabled()) {
             X_Debug::init(sys_get_temp_dir() . "/vlcShares.thread-{$this->getId()}.log", X_Debug::getLevel());
         }
     }
     $this->logger->log($msg);
 }