gioco-plus / grabber-log
Installs: 10 086
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- gioco-plus/prism-plus: dev-master || >=1
README
初始化
use GiocoPlus\GrabberLog\GrabberLog;
/** * GrabberLog constructor. * @param string $vendorCode * @param array $options * @throws \Exception */ $grabberLog = new GrabberLog($vendorCode, $options);
參數說明
$options
ex: $options['agent']
參數皆為選填
紀錄開始
$grabberLog->running($start, $extraParams);
參數說明
紀錄結束 (成功)
$grabberLog->complete($extraParams);
參數說明
紀錄結束 (失敗)
$grabberLog->fail($extraParams, $options);
參數說明
$extraParams
ex: $extraParams['error_message']
參數皆為選填
$options
ex: $options['maintain']
參數皆為選填
額外功能
取得最後一筆 grabber log
$grabberLog->lastLog($filter);
參數說明
取得下次抓取時間
僅適用 log 內有
start
、end
nextGrabber , 返回 Carbon
nextGrabberTime , 返回 timestamp 10 位
['start' => $startTime, 'end' => $endTime] = $grabberLog->nextGrabberTime( $pastMinutes, $longTimeRang, ['bufferNowMin' => $bufferMin] );
參數說明
$options