aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_rest.erl
diff options
context:
space:
mode:
authorAndrew Thompson <[email protected]>2012-12-13 03:38:38 -0500
committerAndrew Thompson <[email protected]>2012-12-13 03:38:38 -0500
commitd916d739d4f844da69ec1c3472b74008dc828e58 (patch)
tree1601fcc15b381e1acdbf3e9adbacdfa7c966ad76 /src/cowboy_rest.erl
parentea7af4b72444890df8cafc624ecdf7e32f7a62cb (diff)
downloadcowboy-d916d739d4f844da69ec1c3472b74008dc828e58.tar.gz
cowboy-d916d739d4f844da69ec1c3472b74008dc828e58.tar.bz2
cowboy-d916d739d4f844da69ec1c3472b74008dc828e58.zip
Make the arguments to error_logger more consistent
The purpose of this patch is to make the arguments cowboy passes to error_logger more consistent. With this patch there's only 3 variations on the error_logger argument list; a 5 element list, an 8 element list and a 10 element list. In all cases, the first 3 arguments are the Module, Function and Arity of the function being called and the second-to-last argument is always the Request. Additionally, for lists longer than 5 elements, the last argument is always the stack-trace. The added consistency of the argument ordering makes it much easier to write code in lager's error_logger handler to catch these messages and write a pretty one-liner (while writing the full message to the crash.log).
Diffstat (limited to 'src/cowboy_rest.erl')
-rw-r--r--src/cowboy_rest.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl
index 35ca34d..c6b53bd 100644
--- a/src/cowboy_rest.erl
+++ b/src/cowboy_rest.erl
@@ -73,10 +73,10 @@ upgrade(_ListenerPid, Handler, Opts, Req) ->
catch Class:Reason ->
PLReq = cowboy_req:to_list(Req),
error_logger:error_msg(
- "** Cowboy handler ~p terminating in rest_init/2~n"
+ "** Cowboy handler ~p terminating in ~p/~p~n"
" for the reason ~p:~p~n** Options were ~p~n"
"** Request was ~p~n** Stacktrace: ~p~n~n",
- [Handler, Class, Reason, Opts, PLReq, erlang:get_stacktrace()]),
+ [Handler, rest_init, 2, Class, Reason, Opts, PLReq, erlang:get_stacktrace()]),
{ok, _Req2} = cowboy_req:reply(500, Req),
close
end.
@@ -735,9 +735,9 @@ choose_content_type(Req,
no_call ->
error_logger:error_msg(
"** Cowboy handler ~p terminating; "
- "function ~p was not exported~n"
+ "function ~p/~p was not exported~n"
"** Request was ~p~n** State was ~p~n~n",
- [Handler, Fun, cowboy_req:to_list(Req), HandlerState]),
+ [Handler, Fun, 2, cowboy_req:to_list(Req), HandlerState]),
{ok, _} = cowboy_req:reply(500, Req),
close;
{halt, Req2, HandlerState} ->
@@ -787,9 +787,9 @@ set_resp_body(Req, State=#state{handler=Handler, handler_state=HandlerState,
no_call ->
error_logger:error_msg(
"** Cowboy handler ~p terminating; "
- "function ~p was not exported~n"
+ "function ~p/~p was not exported~n"
"** Request was ~p~n** State was ~p~n~n",
- [Handler, Fun, cowboy_req:to_list(Req5), HandlerState]),
+ [Handler, Fun, 2, cowboy_req:to_list(Req5), HandlerState]),
{ok, _} = cowboy_req:reply(500, Req5),
close;
{halt, Req6, HandlerState} ->