Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
services
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tencent
services
Commits
2dfec35e
Commit
2dfec35e
authored
Feb 13, 2019
by
王召彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传腾讯云日志支持错误重试
parent
6a1ffe99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
src/Common/ClsLogger/ClsLog.php
+17
-14
No files found.
src/Common/ClsLogger/ClsLog.php
View file @
2dfec35e
...
@@ -50,21 +50,24 @@ class ClsLog
...
@@ -50,21 +50,24 @@ class ClsLog
private
static
function
uploadToCls
(
$topicId
,
$pbData
)
{
private
static
function
uploadToCls
(
$topicId
,
$pbData
)
{
$authorization
=
ClsSignature
::
create
();
$authorization
=
ClsSignature
::
create
();
$uri
=
'http://ap-beijing.cls.myqcloud.com/structuredlog?topic_id='
.
$topicId
;
$uri
=
'http://ap-beijing.cls.myqcloud.com/structuredlog?topic_id='
.
$topicId
;
$res
=
(
new
Client
)
->
post
(
$uri
,
[
for
(
$n
=
0
;
$n
<
3
;
$n
++
){
'headers'
=>
[
$res
=
(
new
Client
)
->
post
(
$uri
,
[
'Host'
=>
'ap-beijing.cls.myqcloud.com'
,
'headers'
=>
[
'Authorization'
=>
$authorization
,
'Host'
=>
'ap-beijing.cls.myqcloud.com'
,
'Content-Type'
=>
'application/x-protobuf'
,
'Authorization'
=>
$authorization
,
],
'Content-Type'
=>
'application/x-protobuf'
,
'body'
=>
$pbData
,
],
'timeout'
=>
20
,
'body'
=>
$pbData
,
]);
'timeout'
=>
30
,
if
(
$res
->
getResponse
()
->
getStatusCode
()
!=
200
)
{
]);
$msg
=
'上传腾讯云日志服务失败:'
.
$res
->
getResult
();
if
(
$res
->
getResponse
()
->
getStatusCode
()
==
200
)
{
self
::
writeClsErrors
(
$msg
);
return
true
;
return
false
;
}
Coroutine
::
sleep
(
1
);
}
}
return
true
;
$msg
=
'上传腾讯云日志服务失败:'
.
$res
->
getResult
();
self
::
writeClsErrors
(
$msg
);
return
false
;
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment