File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
.jvm/src/test/scala/wvlet/airframe/http/client
src/main/scala/wvlet/airframe/http Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,15 @@ class HttpClientLoggingFilterTest extends AirSpec {
6666 test(" switch dest" ) {
6767 client.send(Http .GET (" /" ).withDest(ServerAddress (" localhost:8081" )))
6868 }
69+
70+ test(" with logParameters" ) {
71+ client.send(
72+ Http .GET (" /" ),
73+ context = HttpClientContext (
74+ logParameters = Map (" k1" -> " v1" )
75+ )
76+ )
77+ }
6978 }
7079
7180}
Original file line number Diff line number Diff line change @@ -20,9 +20,11 @@ import wvlet.airframe.http.RPCMethod
2020 * @param rpcMethod
2121 */
2222case class HttpClientContext (
23- clientName : String ,
23+ clientName : String = " default " ,
2424 rpcMethod : Option [RPCMethod ] = None ,
25- rpcInput : Option [Any ] = None
25+ rpcInput : Option [Any ] = None ,
26+ // Extra parameters used for logging
27+ logParameters : Map [String , Any ] = Map .empty
2628)
2729
2830object HttpClientContext {
Original file line number Diff line number Diff line change @@ -50,8 +50,9 @@ object HttpLogs extends LogSupport {
5050 m ++= requestHeaderLogs(request, httpLogger.excludeHeaders)
5151
5252 // Log RPC context in the client side
53- clientContext.foreach {
54- _.rpcMethod.map { rpc => m ++= rpcMethodLogs(rpc) }
53+ clientContext.foreach { ctx =>
54+ ctx.rpcMethod.map { rpc => m ++= rpcMethodLogs(rpc) }
55+ m ++= ctx.logParameters
5556 }
5657 // Log RPC context in the server side
5758 rpcContext.flatMap(_.rpcCallContext).foreach { rcc =>
You can’t perform that action at this time.
0 commit comments