jiahuili430 commented on code in PR #8:
URL: https://github.com/apache/couchdb-ibrowse/pull/8#discussion_r2373346588


##########
src/ibrowse_http_client.erl:
##########
@@ -324,34 +324,55 @@ code_change(_OldVsn, State, _Extra) ->
 
 
 %%--------------------------------------------------------------------
-%% Function: format_status/2
+%% Function: format_status/1
 %% Purpose: Clean process state before logging
-%% Returns: key value list
+%% Returns: key value maps
 %%--------------------------------------------------------------------
-format_status(_Opt, [_PDict, State]) ->
-    #state{
-        reqs=Reqs,
-        reply_buffer=ReplyBuf,
-        recvd_headers=RCVDHeaders,
-        raw_headers=RawHeaders,
-        chunk_size_buffer=ChunkSizeBuf,
-        cur_req=Request
-    } = State,
-    ScrubbedReq = Request#request{url=url_strip_password(Request#request.url)},
-    Scrubbed = State#state{
-        reqs={queue_length, queue:len(Reqs)},
-        reply_buffer={byte_size, byte_size(ReplyBuf)},
-        recvd_headers=lists:map(fun({K, _V}) -> K end, RCVDHeaders),
-        raw_headers={byte_size, byte_size(RawHeaders)},
-        chunk_size_buffer={byte_size, byte_size(ChunkSizeBuf)},
-        cur_req=ScrubbedReq
-    },
-    [{data, [{"State",
-        lists:zip(
-            record_info(fields, state),
-            tl(tuple_to_list(Scrubbed))
-        )
-    }]}].
+format_status(Status) ->
+    maps:map(
+        fun
+            (state, State) ->
+                #state{
+                    reqs = Reqs,
+                    reply_buffer = ReplyBuf,
+                    recvd_headers = RCVDHeaders,
+                    raw_headers = RawHeaders,
+                    chunk_size_buffer = ChunkSizeBuf,
+                    cur_req = Request
+                } = State,
+                ScrubbedReq =
+                    case is_record(Request, request) of
+                        true ->
+                            Request#request{
+                                url = url_strip_password(Request#request.url)
+                            };
+                        false ->
+                            Request
+                    end,
+                RawHeadersSize =
+                    case is_bitstring(RawHeaders) of

Review Comment:
   Not sure how to set `recvd_headers` and `raw_headers`.
   If I run CouchDB locally, `_replicate` the db to db2 continuously, and 
delete db2 with headers.
   It always `undefined`.
   
   Maybe I should use `is_binary()`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to