记录信息到日志文件
底层是通过error_log函数
@param unknown $data
@param string $fileName
766841
public static function log($data, $fileName = 'log', $ext='txt', $format='Ymd') {
        $filePath = Config::getx('path_temp') . 'logs'. DIRECTORY_SEPARATOR;
        if (!is_dir($filePath)) {
            if(!mkdir($filePath,0755,true)){
                throw new \Exception('Create log dir is fail!');
            }
        }
        $message = '[' . date("Y-m-d h:i:s") . ']  ';
        if($data instanceof \Throwable) {
            $message .= $data->getMessage().' in '.$data->getFile().':'.$data->getLine();
        }
        else {
            $message .= (is_array($data) ? print_r($data, true) : $data);
        }
        $message .="\n";
        $format = date($format);
        $fileName = "{$filePath}{$fileName}_{$format}.{$ext}";
        error_log($message, 3, $fileName);
    }
731054
public static function setDebug($filename = '')
    {
        if ($filename != false && gettype($filename) != 'string') {
            phpCAS :: error('type mismatched for parameter $dbg (should be false or the name of the log file)');
        }
        if ($filename === false) {
            self::$_PHPCAS_DEBUG['filename'] = false;

        } else {
            if (empty ($filename)) {
                if (preg_match('/^Win.*/', getenv('OS'))) {
                    if (isset ($_ENV['TMP'])) {
                        $debugDir = $_ENV['TMP'] . '/';
                    } else {
                        $debugDir = '';
                    }
                } else {
                    $debugDir = DEFAULT_DEBUG_DIR;
                }
                $filename = $debugDir . 'phpCAS.log';
            }

            if (empty (self::$_PHPCAS_DEBUG['unique_id'])) {
                self::$_PHPCAS_DEBUG['unique_id'] = substr(strtoupper(md5(uniqid(''))), 0, 4);
            }

            self::$_PHPCAS_DEBUG['filename'] = $filename;
            self::$_PHPCAS_DEBUG['indent'] = 0;

            phpCAS :: trace('START ('.date("Y-m-d H:i:s").') phpCAS-' . PHPCAS_VERSION . ' ******************');
        }
    }
475379
protected function renderFile($fileName, array $data = [])
    {
        /** @noinspection OnlyWritesOnParameterInspection */
        /** @noinspection PhpUnusedLocalVariableInspection */
        $lang = new Language($fileName);
        extract($data, EXTR_PREFIX_SAME || EXTR_REFS, 'data');
        ob_start();

        /** @noinspection PhpIncludeInspection */
        include str_replace('\\', '/', $fileName);

        if (!empty($GLOBALS['widgetStack'])) {
            throw new Exception(count($GLOBALS['widgetStack']).' widgets not endings.');
        }

        return ob_get_clean();
    }
912632
protected function parse($data = null, $filename = null)
    {
        if (json_last_error() !== JSON_ERROR_NONE) {
            $error_message  = 'Syntax error';
            if (function_exists('json_last_error_msg')) {
                $error_message = json_last_error_msg();
            }

            $error = [
                'message' => $error_message,
                'type'    => json_last_error(),
                'file'    => $filename,
            ];

            throw new ParseException($error);
        }

        return $data;
    }
734318
function write($filename,$content){
		if(!Config::read('App.Base.enable_cache')){
			return;
		}
		$expire = time() + ($this->getConfig('cache_expiration') * 60);

		$filename = md5($filename);
		$filepath = $this->getConfig('cache_path').$filename.'.tmp';

		if ( ! $fp = @fopen($filepath, 'w')){
			Loader::getClass('Sky.core.Log')->write(400,'Unable to write cache file: '.$filepath);
			Exceptions::showError('error', "Unable to write cache file: ".$filepath);
			
		}
		if (flock($fp, LOCK_EX))
		{
			fwrite($fp, $expire.'T_SKY-->'.$content);
			flock($fp, LOCK_UN);
		}
		else{
			Loader::getClass('Sky.core.Log')->write(300,'Unable to secure a file lock for file at: '.$filepath);
			return;
		}
		fclose($fp);
		@chmod($filepath,0755);
		
	}
902625
public static function set($filename, $data)
    {
        $data = ["_disk_cache" => $data];
        $filename = static::path($filename);
        Json::encodeToFile($filename, $data);
    }
302664
public function filePut($file, $data)
    {
        $file = $this->alias->resolve($file);

        $this->_dirCreate(dirname($file));
        if (file_put_contents($file, $data, LOCK_EX) === false) {
            throw new RuntimeException(['write `:file` file failed: :last_error_message', 'file' => $file]);
        }
    }
1301306
public static function save( $fileName, $data )
	{
		$yaml	= FS_File_YAML_Spyc::YAMLDump( $data );
		return FS_File_Writer::save( $fileName, $yaml );
	}
159081
protected function writeCacheFile($filename, $data)
	{
		$dir = pathinfo($filename, PATHINFO_DIRNAME);

		if (!file_exists($dir))
		{
			$mod = $this->options['chmod'] ? $this->options['chmod'] : 0777;
			mkdir($dir, $mod);
		}

		$isNew  = !file_exists($filename);
		$result = file_put_contents($filename, serialize($data), LOCK_EX) !== false;

		if ($isNew && $result !== false && $this->options['chmod'])
		{
			chmod($filename, $this->options['chmod']);
		}

		return $result;
	}
1052283
public static function log(...$data)
    {
        $filename = static::options('root') . '/storage/log/access';
        if (is_array($data) && count($data) === 1) {
            $data = $data[0];
        }
        return File::write($filename, $data, true);
    }
325511
public function setStatementLogFile( $fileName ){
		$this->logFileStatements	= $fileName;
		if( $fileName && !file_exists( dirname( $fileName ) ) )
			mkDir( dirname( $fileName ), 0700, TRUE );
	}
548035
public function log($data, $level = self::LEVEL_INFO, $type = null)
    {
        if (!is_string($data)) {
            $data = print_r($data, true);
        }

        file_put_contents(
            $this->getLogDirectory() . '/' . $this->getLogFilename(),
            $this->getLogMessage($data, $level, $type),
            FILE_APPEND
        );
    }
788457
private function _formatError($trace, Array $data)
    {
        foreach ($trace as $k => $v) {
            if ($k == 0) continue;
            $data['trace'][] = array(
                'file' => isset($v['file']) ? $v['file'] : null,
                'line' => isset($v['line']) ? $v['line'] : null,
                'method' => array(
                    'class' => isset($v['class']) ? $v['class'] : null,
                    'type' => isset($v['type']) ? $v['type'] : null,
                    'function' => isset($v['function']) ? $v['function'] : null,
                    'args' => isset($v['args']) ? $v['args'] : null,
                ),
            );
        }
        return $data;
    }
1351913
protected function createFromBase64($filename, $data)
    {
        // Get temporary destination
        $destination = sys_get_temp_dir() . '/' . str_random(4) . '-' . $filename;

        // Create destination if not already there
        if (is_dir(dirname($destination)) === false) {
            mkdir(dirname($destination), 0755, true);
        }

        // Create temporary file
        file_put_contents($destination, base64_decode($data), 0);

        // Get mime type
        $mime_type = mime_content_type($destination);

        return new UploadedFile($destination, $filename, $mime_type);
    }
549386
public static function error($number, $string, $file, $line)
    {
        throw new \ErrorException($string, 0, $number, $file, $line);
    }
1054274
private function log($data)
    {
        $data = date(DATE_RSS, time()) . "\t$data\n";
        file_put_contents($this->storage('.log'), $data, FILE_APPEND);
    }
515364
final public function validation($data, $files) {
        $errors = parent::validation($data, $files);
        if (!isset($errors['name'])) {
            $config = cache_config::instance();
            if (in_array($data['name'], array_keys($config->get_locks()))) {
                $errors['name'] = get_string('locknamenotunique', 'cache');
            }
        }
        $errors = $this->plugin_validation($data, $files, $errors);
        return $errors;
    }