Example #1
0
 public function __construct()
 {
     $tmpdir = SCA_Helper::getTempDir();
     $this->loginfo = array($tmpdir . '/log', 'SCAUnitTest');
     $this->loglocn = $tmpdir . '/log/SCAUnitTest.log';
 }
Example #2
0
 /**
  * Start/Restart the logger
  *
  * @return null
  */
 public function startLog()
 {
     if ($this->run == SCA_LOGGER_START) {
         // we are already started; this is a second
         // or subsequent call to startLog() - do nothing
         return;
     }
     $dirpath = SCA_Helper::getTempDir() . '/log';
     $file = 'SCA';
     $command = SCA_LOGGER_UPDATE;
     if ($dirpath !== null) {
         $this->dirpath = $dirpath;
         if (!file_exists($dirpath)) {
             mkdir($dirpath);
         }
     }
     if ($file !== null) {
         $this->file = $file;
     }
     $this->logfile = "{$this->dirpath}/{$this->file}.{$this->extn}";
     // turn on if you cannot remember where the log is written to
     //trigger_error("SCA logging started; logging to $this->logfile");
     date_default_timezone_set('UTC');
     /* Delete an existing file, or get the last message index     */
     if ($command == SCA_LOGGER_DELETE) {
         $this->deleteLogFile();
     } else {
         $this->msgIndex = 1;
     }
     $this->run = SCA_LOGGER_START;
 }