Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 8cb7bee12a55adc32528ec1f5829c4679685fc81 1 parent b1c3778
Andrew Thompson authored October 04, 2012 kellymclaughlin committed December 05, 2012

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

  1. 16  src/riak_core_sysmon_handler.erl
16  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,
@@ -91,8 +88,9 @@ handle_event({monitor, Pid, Type, _Info},
91 88
 handle_event({monitor, Pid, Type, Info}, State=#state{timer_ref=TimerRef}) ->
92 89
     %% Reset the inactivity timeout
93 90
     NewTimerRef = reset_timer(TimerRef),
94  
-    Pretty = format_pretty_proc_info(Pid, almost_current_function),
95  
-    lager:info("monitor ~w ~w ~s ~w", [Type, Pid, Pretty, Info]),
  91
+    {Fmt, Args} = format_pretty_proc_info(Pid, almost_current_function),
  92
+    lager:info("monitor ~w ~w "++ Fmt ++ " ~w",
  93
+                          [Type, Pid] ++ Args ++ [Info]),
96 94
     {ok, State#state{timer_ref=NewTimerRef}};
97 95
 handle_event(Event, State=#state{timer_ref=TimerRef}) ->
98 96
     NewTimerRef = reset_timer(TimerRef),
@@ -175,13 +173,13 @@ format_pretty_proc_info(Pid, Acf) ->
175 173
     try
176 174
         case get_pretty_proc_info(Pid, Acf) of
177 175
             undefined ->
178  
-                "";
  176
+                {"", []};
179 177
             Res ->
180  
-                io_lib:format("~w", [Res])
  178
+                {"~w", [Res]}
181 179
         end
182 180
     catch X:Y ->
183  
-            io_lib:format("Pid ~w, ~W ~W at ~w\n",
184  
-                          [Pid, X, 20, Y, 20, erlang:get_stacktrace()])
  181
+        {"Pid ~w, ~W ~W at ~w\n",
  182
+            [Pid, X, 20, Y, 20, erlang:get_stacktrace()]}
185 183
     end.
186 184
 
187 185
 get_pretty_proc_info(Pid) ->

0 notes on commit 8cb7bee

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