PHP code example of cplugins / hlog

1. Go to this page and download the library: Download cplugins/hlog 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/ */

    

cplugins / hlog example snippets


$log = new LogHelper();
<!-- 该方法支持第二个参数, 传入exception对象-->
$log->info("提示信息");

<!-- 该方法支持第二个参数, 传入exception对象-->
$log->debug("调试信息");

<!-- 该方法支持第二个参数, 传入exception对象-->
$log->error("错误信息");

<!-- 该方法支持第二个参数, 传入exception对象-->
$log->warn("警告信息");

if (array_key_exists('error', $response)) 判断下面追加以下代码

try {
    $error = $response["error"];
    $log = new LogHelper();
    $log->error("异常捕获", new UrgentException($error["code"], $error["message"]));
} catch (\Exception $e) {

}