PHP code example of cube-group / myaf-log

1. Go to this page and download the library: Download cube-group/myaf-log library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cube-group / myaf-log example snippets


//初始化日志
Log::init('app');
//支持info、warn、error、fatal类日志
Log::info("路由地址", "跟用户相关的数据", "业务线错误码", "错误码对应的错误信息");
//info日志
Log::info("/user/login", "$uid/$phone/$otherAboutUser", $code, $msg);
//demo,日志打印函数(ext尽量使用array)
Log::info("/user/login", "24325", 9999, "ERR_USER_LOGIN", "啊哈哈", [1,2,3], ['key' => 'what you want"]);
//日志压入存储
Log::flush();

//初始化日志
LogAction::init('test', '0.2.0');
//存储日志
LogAction::save("123333", "user-login", array('phone' => '15901214776','address'=>'中公教育'));
//日志压栈存储
LogAction::flush();