How to use the Log log in the tp5 framework Fastadmin

First of all, fastadmin is developed based on the tp5 framework. After we use fastadmin to write the interface, there is no problem in the interface test, but the front-end cannot interact when accessing it. This is the Log log that comes with the tp5 framework;

The following is an introduction to the use of Log:

use think\Log;

Introduce the Log log under the php file you use.

How to use Log:

Generally use log::write(), because it can be monitored in real time;

method describe
Log::record() Record log information to memory
Log::save() Write the log information stored in memory to
Log::write() Write a log message in real time

grammar: 

Log::write('测试日志信息,这是警告级别,并且实时写入','notice');

Log level :

thinkPHP classifies system logs according to levels, and this log can be defined by itself

1.log regular log, used to record

2.error error will cause the program to terminate directly

3.info information, program output information

4.sql SQL statement, used for the record of SQL statement, can only be used in the debugging mode of the database

Use Log:

The basics are the introduction, now let's talk about how to use it

public function index(){
		if($this->request->isAjax()){
                        //接口
			$url = "";
                        //发送请求
			$res = make_request($url);
                        //将接口返回的信息写入日志
			Log::write('index.res'.$res['result'],'info');
		}
	}

The log record is complete, but where is the log stored?

in the real directory;

 

 

Guess you like

Origin blog.csdn.net/wangxuanyang_zer/article/details/130480266