diff options
author | Magnus Klaar <[email protected]> | 2012-03-31 11:04:52 -0700 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-04-01 17:57:00 +0200 |
commit | 5a7040ee1ce1c8413fcf372fd58c2010fcca3795 (patch) | |
tree | ce91177efa909690fb297b8e5403dabe5a120009 /src/cowboy_http_protocol.erl | |
parent | 4fb2a6face6e7d6ff1dd34a02c3bd8b63d972624 (diff) | |
download | cowboy-5a7040ee1ce1c8413fcf372fd58c2010fcca3795.tar.gz cowboy-5a7040ee1ce1c8413fcf372fd58c2010fcca3795.tar.bz2 cowboy-5a7040ee1ce1c8413fcf372fd58c2010fcca3795.zip |
Convert request to proplist when logging
Diffstat (limited to 'src/cowboy_http_protocol.erl')
-rw-r--r-- | src/cowboy_http_protocol.erl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl index 6125d83..ecc7286 100644 --- a/src/cowboy_http_protocol.erl +++ b/src/cowboy_http_protocol.erl @@ -261,12 +261,13 @@ handler_init(Req, State=#state{transport=Transport, upgrade_protocol(Req, State, Module) catch Class:Reason -> error_terminate(500, State), + PLReq = lists:zip(record_info(fields, http_req), tl(tuple_to_list(Req))), error_logger:error_msg( "** Handler ~p terminating in init/3~n" " for the reason ~p:~p~n" "** Options were ~p~n" "** Request was ~p~n** Stacktrace: ~p~n~n", - [Handler, Class, Reason, Opts, Req, erlang:get_stacktrace()]) + [Handler, Class, Reason, Opts, PLReq, erlang:get_stacktrace()]) end. -spec upgrade_protocol(#http_req{}, #state{}, atom()) -> ok. @@ -283,13 +284,14 @@ handler_handle(HandlerState, Req, State=#state{handler={Handler, Opts}}) -> {ok, Req2, HandlerState2} -> terminate_request(HandlerState2, Req2, State) catch Class:Reason -> + PLReq = lists:zip(record_info(fields, http_req), tl(tuple_to_list(Req))), error_logger:error_msg( "** Handler ~p terminating in handle/2~n" " for the reason ~p:~p~n" "** Options were ~p~n** Handler state was ~p~n" "** Request was ~p~n** Stacktrace: ~p~n~n", [Handler, Class, Reason, Opts, - HandlerState, Req, erlang:get_stacktrace()]), + HandlerState, PLReq, erlang:get_stacktrace()]), handler_terminate(HandlerState, Req, State), error_terminate(500, State) end. @@ -341,13 +343,14 @@ handler_call(HandlerState, Req, State=#state{handler={Handler, Opts}}, handler_before_loop(HandlerState2, Req2, State#state{hibernate=true}) catch Class:Reason -> + PLReq = lists:zip(record_info(fields, http_req), tl(tuple_to_list(Req))), error_logger:error_msg( "** Handler ~p terminating in info/3~n" " for the reason ~p:~p~n" "** Options were ~p~n** Handler state was ~p~n" "** Request was ~p~n** Stacktrace: ~p~n~n", [Handler, Class, Reason, Opts, - HandlerState, Req, erlang:get_stacktrace()]), + HandlerState, PLReq, erlang:get_stacktrace()]), handler_terminate(HandlerState, Req, State), error_terminate(500, State) end. @@ -357,13 +360,14 @@ handler_terminate(HandlerState, Req, #state{handler={Handler, Opts}}) -> try Handler:terminate(Req#http_req{resp_state=locked}, HandlerState) catch Class:Reason -> + PLReq = lists:zip(record_info(fields, http_req), tl(tuple_to_list(Req))), error_logger:error_msg( "** Handler ~p terminating in terminate/2~n" " for the reason ~p:~p~n" "** Options were ~p~n** Handler state was ~p~n" "** Request was ~p~n** Stacktrace: ~p~n~n", [Handler, Class, Reason, Opts, - HandlerState, Req, erlang:get_stacktrace()]) + HandlerState, PLReq, erlang:get_stacktrace()]) end. -spec terminate_request(any(), #http_req{}, #state{}) -> ok. |