-
Notifications
You must be signed in to change notification settings - Fork 56
php sdk更新 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Fnck
wants to merge
19
commits into
aliyun:master
Choose a base branch
from
Fnck:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
php sdk更新 #8
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8b0a8cb
sdk源文件目录调整,增加logger方式调用
Fnck 3c28da2
sdk源文件目录调整,增加logger方式调用 - 问题修复
Fnck 91d5975
增加批量日志提交功能
Fnck 28a4487
批量日志提交功能去掉线程锁,增加flush功能
Fnck 45cedf2
1. 增加shipper相关接口,包括增删改查及shipperTask相关查询和重试
Fnck cab78ce
注释增加
Fnck b5b3546
add batch log
Fnck cd00f2a
parquet storage更新
Fnck 3535684
增加注释
Fnck 6c0e7ff
update demo
Fnck ef4f26d
增加loggerFactory逻辑
Fnck ec57d5f
bug fixed
Fnck 67f88e2
logFactory重写
Fnck 30ac7b1
code review重写
Fnck faa0341
updated
Fnck 4215f3f
updated
Fnck 9232ddb
comment and description added
Fnck 27208ab
comment and description added
Fnck c950d80
comment and description added
Fnck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
| /** | ||
| * Copyright (C) Alibaba Cloud Computing | ||
| * All rights reserved | ||
| */ | ||
|
|
||
| /** | ||
| * Class Aliyun_Log_LoggerFactory | ||
| */ | ||
| class Aliyun_Log_LoggerFactory{ | ||
|
|
||
| private static $loggerMap = array(); | ||
|
|
||
| public static function getLogger($client, $project, $logstore, $topic = null){ | ||
| if($project === null || $project == ''){ | ||
| throw new Exception('project name is blank!'); | ||
| } | ||
| if($logstore === null || $logstore == ''){ | ||
| throw new Exception('logstore name is blank!'); | ||
| } | ||
| if($topic === null){ | ||
| $topic = 'MainFlow'; | ||
| } | ||
| $loggerKey = $project.'#'.$logstore.'#'.$topic; | ||
| if (!array_key_exists($loggerKey, static::$loggerMap) || static::$loggerMap[$loggerKey] === null) { | ||
| $instanceSimpleLogger = new Aliyun_Log_SimpleLogger($client,$project,$logstore,$topic); | ||
| static::$loggerMap[$loggerKey] = $instanceSimpleLogger; | ||
| } | ||
| return static::$loggerMap[$loggerKey]; | ||
| } | ||
|
|
||
| protected function __construct() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 析构的时候, 检查一下每个logger 中,是否还要没有发送出去的数据,如果有的话,需要发送出去 |
||
| { | ||
|
|
||
| } | ||
|
|
||
| private function __clone() | ||
| {} | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| <?php | ||
| /** | ||
| * Copyright (C) Alibaba Cloud Computing | ||
| * All rights reserved | ||
| */ | ||
|
|
||
| class Aliyun_Log_Models_LogLevel_LogLevel{ | ||
| const debug = 'debug'; | ||
| const info = 'info'; | ||
| const warn = 'warn'; | ||
| const error = 'error'; | ||
|
|
||
| private static $constCacheArray = NULL; | ||
|
|
||
| private $level; | ||
|
|
||
| /** | ||
| * Constructor | ||
| * | ||
| * @param string $level | ||
| */ | ||
| private function __construct($level) { | ||
| $this->level = $level; | ||
| } | ||
|
|
||
| /** | ||
| * Compares two logger levels. | ||
| * | ||
| * @param LoggerLevels $other | ||
| * @return boolean | ||
| */ | ||
| public function equals($other) { | ||
| if($other instanceof Aliyun_Log_Models_LogLevel_LogLevel) { | ||
| if($this->level == $other->level) { | ||
| return true; | ||
| } | ||
| } else { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| public static function getLevelDebug(){ | ||
| if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug])){ | ||
| self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug] = new Aliyun_Log_Models_LogLevel_LogLevel('debug'); | ||
| } | ||
| return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug]; | ||
| } | ||
|
|
||
| public static function getLevelInfo(){ | ||
| if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info])){ | ||
| self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info] = new Aliyun_Log_Models_LogLevel_LogLevel('info'); | ||
| } | ||
| return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info]; | ||
| } | ||
|
|
||
| public static function getLevelWarn(){ | ||
| if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn])){ | ||
| self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn] = new Aliyun_Log_Models_LogLevel_LogLevel('warn'); | ||
| } | ||
| return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn]; | ||
| } | ||
|
|
||
| public static function getLevelError(){ | ||
| if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error])){ | ||
| self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error] = new Aliyun_Log_Models_LogLevel_LogLevel('error'); | ||
| } | ||
| return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error]; | ||
| } | ||
|
|
||
| public static function getLevelStr(Aliyun_Log_Models_LogLevel_LogLevel $logLevel){ | ||
|
|
||
| $logLevelStr = ''; | ||
| if(null === $logLevel){ | ||
| $logLevelStr = 'info'; | ||
| } | ||
| switch ($logLevel->level){ | ||
| case "error": | ||
| $logLevelStr= 'error'; | ||
| break; | ||
| case "warn": | ||
| $logLevelStr= 'warn'; | ||
| break; | ||
| case "info": | ||
| $logLevelStr= 'info'; | ||
| break; | ||
| case "debug": | ||
| $logLevelStr= 'debug'; | ||
| break; | ||
| } | ||
| return $logLevelStr; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if topic == NULL => topic = ""