...
|
...
|
@@ -17,6 +17,8 @@ namespace WebPlugin; |
|
|
*/
|
|
|
class UdpLog
|
|
|
{
|
|
|
//日志开关
|
|
|
private static $flag = true;
|
|
|
//influxdb url
|
|
|
public static $url = 'influxdb.yohobuy.com';
|
|
|
//influxdb port
|
...
|
...
|
@@ -32,6 +34,15 @@ class UdpLog |
|
|
const RECORD_MODE = 'FILE';//mode: FILE | UDP
|
|
|
|
|
|
/**
|
|
|
* 初始化
|
|
|
*/
|
|
|
private function __construct()
|
|
|
{
|
|
|
if (self::$flag) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* proc line and send log to influxdb
|
|
|
* @param $level
|
|
|
* @param $message
|
...
|
...
|
@@ -158,4 +169,13 @@ class UdpLog |
|
|
public static function debug($message, $meta = '') {
|
|
|
self::procLog(__METHOD__, $message, debug_backtrace(), $meta);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* yaf trigger error
|
|
|
* @param $message
|
|
|
* @param mixed $meta
|
|
|
*/
|
|
|
public static function triggerError($message, $meta = '') {
|
|
|
self::procLog(__METHOD__, $message, debug_backtrace(), $meta);
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|