Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
578b8e94
Commit
578b8e94
authored
Apr 14, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:埋点502修改
parent
bc2815e8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
DefaultFormatPrinter.java
ydl-net/src/main/java/com/ydl/ydlnet/builder/interceptor/log/DefaultFormatPrinter.java
+6
-5
No files found.
ydl-net/src/main/java/com/ydl/ydlnet/builder/interceptor/log/DefaultFormatPrinter.java
View file @
578b8e94
...
@@ -52,7 +52,7 @@ public class DefaultFormatPrinter {
...
@@ -52,7 +52,7 @@ public class DefaultFormatPrinter {
public
void
printJsonRequest
(
@NonNull
Request
request
,
@NonNull
String
bodyString
)
{
public
void
printJsonRequest
(
@NonNull
Request
request
,
@NonNull
String
bodyString
)
{
final
String
requestBody
=
LINE_SEPARATOR
+
BODY_TAG
+
LINE_SEPARATOR
+
bodyString
;
final
String
requestBody
=
LINE_SEPARATOR
+
BODY_TAG
+
LINE_SEPARATOR
+
bodyString
;
final
String
tag
=
getTag
(
true
);
final
String
tag
=
getTag
(
true
);
if
(!
request
.
url
().
toString
().
contains
(
"writeMaiDianData"
)){
NetLogUtils
.
debugInfo
(
tag
,
REQUEST_UP_LINE
);
NetLogUtils
.
debugInfo
(
tag
,
REQUEST_UP_LINE
);
logLines
(
tag
,
new
String
[]{
URL_TAG
+
request
.
url
()},
false
);
logLines
(
tag
,
new
String
[]{
URL_TAG
+
request
.
url
()},
false
);
logLines
(
tag
,
getRequest
(
request
),
true
);
logLines
(
tag
,
getRequest
(
request
),
true
);
...
@@ -60,6 +60,8 @@ public class DefaultFormatPrinter {
...
@@ -60,6 +60,8 @@ public class DefaultFormatPrinter {
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
}
}
}
/**
/**
* 打印网络请求信息, 当网络请求时 {{@link okhttp3.RequestBody}} 为 {@code null} 或不可解析的情况
* 打印网络请求信息, 当网络请求时 {{@link okhttp3.RequestBody}} 为 {@code null} 或不可解析的情况
*
*
...
@@ -68,7 +70,7 @@ public class DefaultFormatPrinter {
...
@@ -68,7 +70,7 @@ public class DefaultFormatPrinter {
public
void
printFileRequest
(
@NonNull
Request
request
)
{
public
void
printFileRequest
(
@NonNull
Request
request
)
{
final
String
tag
=
getTag
(
true
);
final
String
tag
=
getTag
(
true
);
if
(!
request
.
url
().
toString
().
contains
(
"writeMaiDianData"
)){
NetLogUtils
.
debugInfo
(
tag
,
REQUEST_UP_LINE
);
NetLogUtils
.
debugInfo
(
tag
,
REQUEST_UP_LINE
);
logLines
(
tag
,
new
String
[]{
URL_TAG
+
request
.
url
()},
false
);
logLines
(
tag
,
new
String
[]{
URL_TAG
+
request
.
url
()},
false
);
logLines
(
tag
,
getRequest
(
request
),
true
);
logLines
(
tag
,
getRequest
(
request
),
true
);
...
@@ -76,6 +78,8 @@ public class DefaultFormatPrinter {
...
@@ -76,6 +78,8 @@ public class DefaultFormatPrinter {
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
}
}
}
/**
/**
* 打印网络响应信息, 当网络响应时 {{@link okhttp3.ResponseBody}} 可以解析的情况
* 打印网络响应信息, 当网络响应时 {{@link okhttp3.ResponseBody}} 可以解析的情况
*
*
...
@@ -98,7 +102,6 @@ public class DefaultFormatPrinter {
...
@@ -98,7 +102,6 @@ public class DefaultFormatPrinter {
final
String
responseBody
=
LINE_SEPARATOR
+
BODY_TAG
+
LINE_SEPARATOR
+
bodyString
;
final
String
responseBody
=
LINE_SEPARATOR
+
BODY_TAG
+
LINE_SEPARATOR
+
bodyString
;
final
String
tag
=
getTag
(
false
);
final
String
tag
=
getTag
(
false
);
final
String
[]
urlLine
=
{
URL_TAG
+
responseUrl
,
N
};
final
String
[]
urlLine
=
{
URL_TAG
+
responseUrl
,
N
};
NetLogUtils
.
debugInfo
(
tag
,
RESPONSE_UP_LINE
);
NetLogUtils
.
debugInfo
(
tag
,
RESPONSE_UP_LINE
);
logLines
(
tag
,
urlLine
,
true
);
logLines
(
tag
,
urlLine
,
true
);
logLines
(
tag
,
getResponse
(
headers
,
chainMs
,
code
,
isSuccessful
,
segments
,
message
),
true
);
logLines
(
tag
,
getResponse
(
headers
,
chainMs
,
code
,
isSuccessful
,
segments
,
message
),
true
);
...
@@ -122,13 +125,11 @@ public class DefaultFormatPrinter {
...
@@ -122,13 +125,11 @@ public class DefaultFormatPrinter {
@NonNull
List
<
String
>
segments
,
@NonNull
String
message
,
@NonNull
final
String
responseUrl
)
{
@NonNull
List
<
String
>
segments
,
@NonNull
String
message
,
@NonNull
final
String
responseUrl
)
{
final
String
tag
=
getTag
(
false
);
final
String
tag
=
getTag
(
false
);
final
String
[]
urlLine
=
{
URL_TAG
+
responseUrl
,
N
};
final
String
[]
urlLine
=
{
URL_TAG
+
responseUrl
,
N
};
if
(!
responseUrl
.
contains
(
"writeMaiDianData"
)){
NetLogUtils
.
debugInfo
(
tag
,
RESPONSE_UP_LINE
);
NetLogUtils
.
debugInfo
(
tag
,
RESPONSE_UP_LINE
);
logLines
(
tag
,
urlLine
,
true
);
logLines
(
tag
,
urlLine
,
true
);
logLines
(
tag
,
getResponse
(
headers
,
chainMs
,
code
,
isSuccessful
,
segments
,
message
),
true
);
logLines
(
tag
,
getResponse
(
headers
,
chainMs
,
code
,
isSuccessful
,
segments
,
message
),
true
);
logLines
(
tag
,
OMITTED_RESPONSE
,
true
);
logLines
(
tag
,
OMITTED_RESPONSE
,
true
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
}
}
}
...
...
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