Example #1
0
 /**
  *
  * @param string $logPath
  *            filepath including filename
  * @param boolean $logPathAbsolute
  *            by default provided $logPath is relative to BASE_LOG_FOLDER
  * @param boolean $useFileDateSuffix
  *            files created will be with date suffix in the end (i.e. temp.log will become temp_20140911.log)
  * @return Logger returns new logger object with everything set to use @see log() function
  */
 public static function newLogger($logPath, $logPathAbsolute = FALSE, $useFileDateSuffix = TRUE)
 {
     $logger = new self();
     $logFilename = pathinfo($logPath, PATHINFO_BASENAME);
     $folder = pathinfo($logPath, PATHINFO_DIRNAME);
     if ($logPathAbsolute) {
         if ($folder === '.') {
             $folder = '';
         }
         $logFilename = pathinfo($logPath, PATHINFO_BASENAME);
     } elseif (empty($folder) || $folder == '.') {
         $folder = NULL;
     }
     $logger->setLogFolder($folder, $logPathAbsolute);
     $logger->setLogFilename($logFilename, $useFileDateSuffix);
     return $logger;
 }