记录提示信息日志
@param $message
@param $logFile 日志文件名称，如果没有指定则记录到默认的日志文件
@return int
500219
public static function info($message, $logFile='') {

        if ( $message instanceof HeroException ) $message = $message->toString();

        if ( is_object($message) ) $message = serialize($message);

        if ( is_array($message) ) $message = StringUtils::jsonEncode($message);

        $logDir = APP_RUNTIME_PATH . 'logs/'.date('Y').'/'.date('m').'/';
        if ( !file_exists($logDir) ) FileUtils::makeFileDirs($logDir);
        return file_put_contents($logDir.date("Y-m-d").'-'.$logFile.self::LOG_INFO, '['.date('Y-m-d H:i:s').'] '.$message."\n", FILE_APPEND);
    }
40549
static function write( $message, $logName = 'common.log', $dir = 'var/log' )
    {
        $fileName = $dir . '/' . $logName;
        $oldumask = @umask( 0 );

        $fileExisted = file_exists( $fileName );
        if ( $fileExisted and
             filesize( $fileName ) > eZLog::maxLogSize() )
        {
            if ( eZLog::rotateLog( $fileName ) )
                $fileExisted = false;
        }
        else if ( !$fileExisted and !file_exists( $dir ) )
        {
            eZDir::mkdir( $dir, false, true );
        }

        $logFile = @fopen( $fileName, "a" );
        if ( $logFile )
        {
            $time = strftime( "%b %d %Y %H:%M:%S", strtotime( "now" ) );
            $logMessage = "[ " . $time . " ] $message\n";
            @fwrite( $logFile, $logMessage );
            @fclose( $logFile );
            if ( !$fileExisted )
            {
                $ini = eZINI::instance();
                $permissions = octdec( $ini->variable( 'FileSettings', 'LogFilePermissions' ) );
                @chmod( $fileName, $permissions );
            }
            @umask( $oldumask );
        }
        else
        {
            eZDebug::writeError( 'Couldn\'t create the log file "' . $fileName . '"', __METHOD__ );
        }
    }
10459
function _append_log($message_number, $message)
    {
            switch (NET_SSH2_LOGGING) {
                // useful for benchmarks
                case NET_SSH2_LOG_SIMPLE:
                    $this->message_number_log[] = $message_number;
                    break;
                // the most useful log for SSH2
                case NET_SSH2_LOG_COMPLEX:
                    $this->message_number_log[] = $message_number;
                    $this->_string_shift($message);
                    $this->log_size+= strlen($message);
                    $this->message_log[] = $message;
                    while ($this->log_size > NET_SSH2_LOG_MAX_SIZE) {
                        $this->log_size-= strlen(array_shift($this->message_log));
                        array_shift($this->message_number_log);
                    }
                    break;
                // dump the output out realtime; packets may be interspersed with non packets,
                // passwords won't be filtered out and select other packets may not be correctly
                // identified
                case NET_SSH2_LOG_REALTIME:
                    echo "<pre>\r\n" . $this->_format_log(array($message), array($message_number)) . "\r\n</pre>\r\n";
                    flush();
                    ob_flush();
                    break;
                // basically the same thing as NET_SSH2_LOG_REALTIME with the caveat that NET_SSH2_LOG_REALTIME_FILE
                // needs to be defined and that the resultant log file will be capped out at NET_SSH2_LOG_MAX_SIZE. 
                // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily
                // at the beginning of the file
                case NET_SSH2_LOG_REALTIME_FILE:
                    if (!isset($this->realtime_log_file)) {
                        // PHP doesn't seem to like using constants in fopen()
                        $filename = NET_SSH2_LOG_REALTIME_FILE;
                        $fp = fopen($filename, 'w');
                        $this->realtime_log_file = $fp;
                    }
                    if (!is_resource($this->realtime_log_file)) {
                        break;
                    }
                    $entry = $this->_format_log(array($message), array($message_number));
                    if ($this->realtime_log_wrap) {
                        $temp = "<<< START >>>\r\n";
                        $entry.= $temp;
                        fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp));
                    }
                    $this->realtime_log_size+= strlen($entry);
                    if ($this->realtime_log_size > NET_SSH2_LOG_MAX_SIZE) {
                        fseek($this->realtime_log_file, 0);
                        $this->realtime_log_size = strlen($entry);
                        $this->realtime_log_wrap = true;
                    }
                    fputs($this->realtime_log_file, $entry);
            }
    }
772124
public static function add($message = 'No message', $logCode = self::LEVEL_INFO)
    {
        // if file pointer doesn't exist, then open log file  
        if (!self::$_fileHandler) {
            self::_openLogFile();
        }

        // Get user IP
        if (!empty($_SERVER['REMOTE_ADDR'])) {
            $userIP = $_SERVER['REMOTE_ADDR'];
        } else {
            $userIP = '0.0.0.0';
        }

        // define current time  
        $time = date('j/M/Y H:i:s');

        // define script name  
        $scriptName = pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME);

        // write message to the log file
        $fwrite = fwrite(self::$_fileHandler, "$userIP [$time][$logCode] ($scriptName) --> $message\n");
        
        if ($fwrite === false) {
            return false;
        } else {
            return true;
        }
    }
508811
private function _log($level, $message)
    {
        $level_config = Config::get("log_level");
        if (!$level_config) {
            $level_config = "DEBUG";
        }

        $level_val = self::$levels[$level];
        $level_config = self::$levels[$level_config];

        if ($level_config > $level_val) {
            return ;
        }

        wlog($level, $message);
    }
623645
public function clearLog($logKey = null)
    {
        $ret=true;
        if ($logKey==null) {
            foreach ($this->_logFiles as $key => $logFile) {
                $ret = $ret && $this->write("", $logFile);
            }
            return $ret;
        } else {
            $arrayKey=strtolower($logKey);
            if (isset($this->_logFiles[$arrayKey])) {
                return $this->write("", $this->_logFiles[$arrayKey]);
            } else {
                return 0;
            }
        }
    }
1234610
private function log($message)
    {
        if (!is_null($this->logger)) {
            $this->logger->log(
                LogLevel::DEBUG,
                sprintf("[%s] - %s", date('Y-m-d H:i:s'), $message)
            );
        }
    }
859012
public function setXincLogFile($logFile)
    {
        $parentDir = dirname($logFile);

        if (!is_writeable($logFile) && !is_writeable($parentDir)) {
            $this->error('Cannot open "'.$logFile.'" for writing', STDERR);
            throw new Logger\Exception\NonWriteableException($logFile);
        }
        $this->file = $logFile;
    }
235988
public static function getInstance($logFile = 'static.log', $logDir = 'data/logs')
    {
        if (static::$instance instanceof StaticLogger) {
            return static::$instance;
        }
        static::$instance = new self($logFile, $logDir);

        return static::$instance;
    }
130157
public function log(int $level, string $message)
    {
        // no log command
        if (!$level || ($level & $this->level) == 0) {
            return;
        }

        // ensure log directory
        $this->checkDirectory();

        // prepare message prepend
        $levelText = '';
        switch ($level) {
            case self::FAIL:
                $levelText = 'FAIL';
                break;
            case self::INFO:
                $levelText = 'INFO';
                break;
            case self::WARN:
                $levelText = 'WARN';
                break;
            case self::DEBUG:
                $levelText = 'DEBUG';
                break;
        }

        // prepare message & message file
        $message = sprintf('[%s] %s >> %s', $levelText, date('D, d M Y H:i:s O'), trim($message) ."\n");
        $messageFile = sprintf('%s/%s.log', $this->directory, date('Y-m-d'));

        return error_log($message, 3, $messageFile);
    }
1323957
public function log($level, $message)
    {
        if (func_num_args() > 3) {
            $args = array_slice(func_get_args(), 3);
            if (is_array($args[0])) {
                $args = $args[0];
            }
            $this->log->write($level, $this->className, $message, $args);
        } else {
            $this->log->write($level, $this->className, $message);
        }
    }
545719
protected function log($message)
    {
        $this->debug && Log::info($this->lockfilePath . ' ' . getmypid() . ' ' . $message);
    }
727860
public static function error_log_wrap($message)
  {
    // msglen is the remain length of the message that needs to be written.
    $msglen=strlen($message);
    $i=0;
    while($msglen>0){
      if($msglen>8000){
        // the remaining message that needs to be written is still longer than 8000 bytes
        // so error_log only a chunk (start at offset: number of itereations * 8000)
        error_log(substr($message,$i*8000,8000));
        $msglen=$msglen-8000;
      }else{
        // less than 8000 bytes left, write the remainder (end)
        error_log(substr($message,$i*8000));
        $msglen=0;
      }
      $i++;
    }
  }
495054
public function Log($logMessage)
    {
        $target = null;

        if ($user = Sentinel::getUser())
            if ($user != null)
                $target = $user->id;

        $log = $this->getLogsRepository()->create(['log' => $logMessage, 'ip' => Request::ip(), 'target' => $target]);
    }
773890
public function notice($message)
    {
        $args = func_get_args();
        array_shift($args);
        return $this->log(Log::Notice, $message, $args);
    }
785155
public function setLogFile($logFile)
    {
        if (strpos($logFile, '://') === false) {
            if (!GeneralUtility::isAbsPath($logFile)) {
                $logFile = PATH_site . $logFile;
            }
        }

        $this->logFile = $logFile;
        $this->openLogFile();

        return $this;
    }
67090
public function info($message)
    {
        $args = func_get_args();
        array_shift($args);
        return $this->log(Log::Info, $message, $args);
    }