Skip to content
This repository
Browse code

Don't double-format sysmon messages, unexport unused functions

  • Loading branch information...
commit aaa036836f522b852a3780e7bb0c7d612a2af3b7 1 parent 7cff01c
Andrew Thompson authored October 04, 2012

Showing 1 changed file with 7 additions and 10 deletions. Show diff stats Hide diff stats

  1. 17  src/riak_core_sysmon_handler.erl
17  src/riak_core_sysmon_handler.erl
@@ -26,9 +26,6 @@
26 26
 
27 27
 %% API
28 28
 -export([add_handler/0]).
29  
-%% Perhaps useful to the outside world.
30  
--export([format_pretty_proc_info/1, format_pretty_proc_info/2,
31  
-         get_pretty_proc_info/1, get_pretty_proc_info/2]).
32 29
 
33 30
 %% gen_event callbacks
34 31
 -export([init/1, handle_event/2, handle_call/2, 
@@ -81,9 +78,9 @@ init([]) ->
81 78
 %% @end
82 79
 %%--------------------------------------------------------------------
83 80
 handle_event({monitor, Pid, Type, Info}, State) ->
84  
-    Pretty = format_pretty_proc_info(Pid, almost_current_function),
85  
-    lager:info("monitor ~w ~w ~s ~w",
86  
-                          [Type, Pid, Pretty, Info]),
  81
+    {Fmt, Args} = format_pretty_proc_info(Pid, almost_current_function),
  82
+    lager:info("monitor ~w ~w "++ Fmt ++ " ~w",
  83
+                          [Type, Pid] ++ Args ++ [Info]),
87 84
     {ok, State};
88 85
 handle_event(Event, State) ->
89 86
     lager:info("Monitor got ~p", [Event]),
@@ -161,13 +158,13 @@ format_pretty_proc_info(Pid, Acf) ->
161 158
     try
162 159
         case get_pretty_proc_info(Pid, Acf) of
163 160
             undefined ->
164  
-                "";
  161
+                {"", []};
165 162
             Res ->
166  
-                io_lib:format("~w", [Res])
  163
+                {"~w", [Res]}
167 164
         end
168 165
     catch X:Y ->
169  
-            io_lib:format("Pid ~w, ~W ~W at ~w\n",
170  
-                          [Pid, X, 20, Y, 20, erlang:get_stacktrace()])
  166
+        {"Pid ~w, ~W ~W at ~w\n",
  167
+            [Pid, X, 20, Y, 20, erlang:get_stacktrace()]}
171 168
     end.
172 169
 
173 170
 get_pretty_proc_info(Pid) ->

0 notes on commit aaa0368

Please sign in to comment.
Something went wrong with that request. Please try again.