PHP code example of overlu / loghub-sdk

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

    

overlu / loghub-sdk example snippets


composer 

/**
 * @param $type : 操作日志 insert,update,delete
 * @param $content_before : 操作前的数据, array
 * @param $content_after : 操作的数据, array
 * @param $table : 操作的数据表, string
 * @param $owner : 操作人[id,name], array
 * @param $remark : 备注说明, string
 */
\Overlu\Log\Log::operation($type, $content_before, $content_after, $table, $owner, $remark);

\Overlu\Log\Log::operation(
    'update',
    ['id' => 1, 'name' => 'lupeng'],
    ['name' => '陆鹏'],
    'user',
    ['id' => 9, 'name' => 'admins'],
    '更新用户名'
);

/**
 * @param \Exception $exception
 */
\Overlu\Log\Log::error(\Exception $exception);

try {
    do something...
} catch (Exception $exception) {
    \Overlu\Log\Log::error($exception);
}

/**
 * @param $store_code : 日志库编码, string
 * @param $content : 内容, array
 * @param string $type : 日志级别: debug,info(默认),notice,warning,error,alert
 */
\Overlu\Log\Log::push($store_code, $content, $type);

\Overlu\Log\Log::push('store1', ['message'=>'who do something'], 'info');
\Overlu\Log\Log::push('store2', ['message'=>'who do something error'], 'warning');
\Overlu\Log\Log::push('store3', ['message'=>'something bad'], 'alert');