[erlang-patches] odbc and ssl applications use error_logger:error_report/2 instead of error_logger:error_msg/2

Matthew Dempsky <>
Sun Apr 6 06:12:22 CEST 2008


While looking for idiomatic uses of error_logger:error_report in the
OTP distribution, I noticed that the odbc and ssl applications call
error_logger:error_report/2 with arguments that look intended for
error_logger:error_msg/2.  The patch below corrects this.

--- odbc/src/odbc.erl.orig	2008-04-05 21:00:25.000000000 -0700
+++ odbc/src/odbc.erl	2008-04-05 21:01:03.000000000 -0700
@@ -678,8 +678,8 @@
  	ok ->
  	    ok;
  	{error, Reason} ->
- 	    error_logger:error_report("ODBC could not end connection "
- 				      "gracefully due to ~p~n", [Reason])
+ 	    error_logger:error_msg("ODBC could not end connection "
+                                   "gracefully due to ~p~n", [Reason])
     end,

     {stop, normal, State#state{reply_to = undefined}};
@@ -754,8 +754,7 @@
 %% so we do not want to crash, but we make a log entry as it is an
 %% unwanted behaviour.)
 handle_info(Info, State) ->
-    error_logger:error_report("ODBC: received unexpected info: ~p~n",
-			      [Info]),
+    error_logger:error_msg("ODBC: received unexpected info: ~p~n", [Info]),
     {noreply, State}.

 %%--------------------------------------------------------------------------
--- ssl/src/ssl_handshake.erl.orig	2008-04-05 21:05:12.000000000 -0700
+++ ssl/src/ssl_handshake.erl	2008-04-05 21:05:52.000000000 -0700
@@ -274,8 +274,8 @@
 	    Result
     catch
 	exit:Reason ->
-	    error_logger:error_report("Key calculation failed due to ~p",
-				      [Reason]),
+	    error_logger:error_msg("Key calculation failed due to ~p~n",
+                                   [Reason]),
 	    #alert{level = ?FATAL, description = ?HANDSHAKE_FAILURE}
     end;

@@ -294,8 +294,8 @@

     catch
 	exit:Reason ->
-	    error_logger:error_report("Master secret calculation failed"
-				      " due to ~p", [Reason]),
+	    error_logger:error_msg("Master secret calculation failed"
+                                   " due to ~p~n", [Reason]),
 	    #alert{level = ?FATAL, description = ?HANDSHAKE_FAILURE}
     end.



More information about the erlang-patches mailing list