Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
d06e3305
Commit
d06e3305
authored
Nov 29, 2020
by
jamesge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use = as non-json sep; Rename LOG* macros to CLOG*
parent
5f7e0480
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
controller.cpp
src/brpc/controller.cpp
+1
-1
controller.h
src/brpc/controller.h
+8
-7
brpc_controller_unittest.cpp
test/brpc_controller_unittest.cpp
+3
-3
No files found.
src/brpc/controller.cpp
View file @
d06e3305
...
...
@@ -1509,7 +1509,7 @@ KVMap& Controller::SessionKV() {
#define BRPC_SESSION_END_MSG "Session ends."
#define BRPC_REQ_ID "@rid"
#define BRPC_KV_SEP "
:
"
#define BRPC_KV_SEP "
=
"
void
Controller
::
FlushSessionKV
(
std
::
ostream
&
os
)
{
if
(
_session_kv
==
nullptr
||
_session_kv
->
Count
()
==
0
)
{
...
...
src/brpc/controller.h
View file @
d06e3305
...
...
@@ -814,12 +814,13 @@ std::ostream& operator<<(std::ostream& os, const Controller::LogPrefixDummy& p);
}
// namespace brpc
// Print logs appended with @rid which is got from "x-request-id"(set
// -request_id_header to change) in http header by default
#define LOGD(cntl) LOG(DEBUG) << (cntl)->LogPrefix()
#define LOGI(cntl) LOG(INFO) << (cntl)->LogPrefix()
#define LOGW(cntl) LOG(WARNING) << (cntl)->LogPrefix()
#define LOGE(cntl) LOG(ERROR) << (cntl)->LogPrefix()
#define LOGF(cntl) LOG(FATAL) << (cntl)->LogPrefix()
// Print contextual logs with @rid which is got from "x-request-id"(changable
// by -request_id_header) in http header by default
#define CLOGD(cntl) LOG(DEBUG) << (cntl)->LogPrefix()
#define CLOGI(cntl) LOG(INFO) << (cntl)->LogPrefix()
#define CLOGW(cntl) LOG(WARNING) << (cntl)->LogPrefix()
#define CLOGE(cntl) LOG(ERROR) << (cntl)->LogPrefix()
#define CLOGF(cntl) LOG(FATAL) << (cntl)->LogPrefix()
#define CVLOG(v, cntl) VLOG(v) << (cntl)->LogPrefix()
#endif // BRPC_CONTROLLER_H
test/brpc_controller_unittest.cpp
View file @
d06e3305
...
...
@@ -117,14 +117,14 @@ TEST_F(ControllerTest, SessionKV) {
cntl
.
SessionKV
().
Set
(
"Cisco"
,
33.33
);
LOGW
(
&
cntl
)
<<
"My WARNING Log"
;
C
LOGW
(
&
cntl
)
<<
"My WARNING Log"
;
ASSERT_TRUE
(
endsWith
(
sink1
,
"] My WARNING Log"
))
<<
sink1
;
ASSERT_TRUE
(
startsWith
(
sink1
,
"W"
))
<<
sink1
;
sink1
.
clear
();
cntl
.
http_request
().
SetHeader
(
"x-request-id"
,
"abcdEFG-456"
);
LOGE
(
&
cntl
)
<<
"My ERROR Log"
;
ASSERT_TRUE
(
endsWith
(
sink1
,
"] @rid
:
abcdEFG-456 My ERROR Log"
))
<<
sink1
;
C
LOGE
(
&
cntl
)
<<
"My ERROR Log"
;
ASSERT_TRUE
(
endsWith
(
sink1
,
"] @rid
=
abcdEFG-456 My ERROR Log"
))
<<
sink1
;
ASSERT_TRUE
(
startsWith
(
sink1
,
"E"
))
<<
sink1
;
sink1
.
clear
();
...
...
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