/** ********************************************************************************************* * @param String $filename This may be a filename under the default logdir * or it may be an explicit filename which is flagged by the $bCreateUnderDefaultLogDir param. * @param Integer $priority Specified from the class constants of the KLogger class. * @param KLogger $pLogger Reference to the logger instance we create here. * @param Boolean $bCreateUnderDefaultLogDir 'true' if you want to use the default-Company log dir * and false if you want to specify your own specific filename as the $filename param. * @return errno -- EOK if no error. * EPERM if we can't create the filename. */ public function CreateLoggerInstance($loggerKeyName, $filename, $priority, &$pLogger, $bCreateUnderDefaultLogDir = true) { // // Check to see if this logger already exists. // if (isset($this->loggers[$loggerKeyName])) { return EEXIST; } // // Check to see if the caller wants to use the default log file location. // if ($bCreateUnderDefaultLogDir == true) { if (!file_exists(LsSys::GetRootLogPath())) { // Owner: RW // Group: RW // Others: R mkdir(LsSys::GetRootLogPath(), 0664, true); } $logFile = LsSys::GetRootLogPath() . "/" . $filename; } else { // // In this case we're creating a specific logfile. // $logFile = $filename; } // // Create the logger instance in the reference provided. // $pLogger = new KLogger($logFile, $priority); if ($pLogger->Log_Status != KLogger::LOG_OPEN) { echo "Failure to create logger {$logFile}\n"; return EPERM; } // // Store the logger on the sysinfo structure. // $this->loggers[$loggerKeyName] = $pLogger; $this->logFileNames[$loggerKeyName] = $filename; return EOK; }