Просмотр исходного кода

Add missing line breaks in error_logger messages

Not having them messages up the crash logs for us as they
are printed verbatim. OTP reports always include at least
one line break (often two) so syn should probably have one too.
Loïc Hoguin 7 лет назад
Родитель
Сommit
473906a73d
4 измененных файлов с 31 добавлено и 31 удалено
  1. 6 6
      src/syn_backbone.erl
  2. 13 13
      src/syn_consistency.erl
  3. 6 6
      src/syn_groups.erl
  4. 6 6
      src/syn_registry.erl

+ 6 - 6
src/syn_backbone.erl

@@ -62,7 +62,7 @@ create_table(TableName, Options) ->
     %% ensure table exists
     %% ensure table exists
     case mnesia:create_table(TableName, Options) of
     case mnesia:create_table(TableName, Options) of
         {atomic, ok} ->
         {atomic, ok} ->
-            error_logger:info_msg("~p was successfully created", [TableName]),
+            error_logger:info_msg("~p was successfully created~n", [TableName]),
             ok;
             ok;
         {aborted, {already_exists, TableName}} ->
         {aborted, {already_exists, TableName}} ->
             %% table already exists, try to add current node as copy
             %% table already exists, try to add current node as copy
@@ -71,7 +71,7 @@ create_table(TableName, Options) ->
             %% table already exists, try to add current node as copy
             %% table already exists, try to add current node as copy
             add_table_copy_to_current_node(TableName);
             add_table_copy_to_current_node(TableName);
         Other ->
         Other ->
-            error_logger:error_msg("Error while creating ~p: ~p", [TableName, Other]),
+            error_logger:error_msg("Error while creating ~p: ~p~n", [TableName, Other]),
             {error, Other}
             {error, Other}
     end.
     end.
 
 
@@ -83,15 +83,15 @@ add_table_copy_to_current_node(TableName) ->
     %% add copy
     %% add copy
     case mnesia:add_table_copy(TableName, CurrentNode, ram_copies) of
     case mnesia:add_table_copy(TableName, CurrentNode, ram_copies) of
         {atomic, ok} ->
         {atomic, ok} ->
-            error_logger:info_msg("Copy of ~p was successfully added to current node", [TableName]),
+            error_logger:info_msg("Copy of ~p was successfully added to current node~n", [TableName]),
             ok;
             ok;
         {aborted, {already_exists, TableName}} ->
         {aborted, {already_exists, TableName}} ->
-            error_logger:info_msg("Copy of ~p is already added to current node", [TableName]),
+            error_logger:info_msg("Copy of ~p is already added to current node~n", [TableName]),
             ok;
             ok;
         {aborted, {already_exists, TableName, CurrentNode}} ->
         {aborted, {already_exists, TableName, CurrentNode}} ->
-            error_logger:info_msg("Copy of ~p is already added to current node", [TableName]),
+            error_logger:info_msg("Copy of ~p is already added to current node~n", [TableName]),
             ok;
             ok;
         {aborted, Reason} ->
         {aborted, Reason} ->
-            error_logger:error_msg("Error while creating copy of ~p: ~p", [TableName, Reason]),
+            error_logger:error_msg("Error while creating copy of ~p: ~p~n", [TableName, Reason]),
             {error, Reason}
             {error, Reason}
     end.
     end.

+ 13 - 13
src/syn_consistency.erl

@@ -97,7 +97,7 @@ init([]) ->
     {stop, Reason :: any(), #state{}}.
     {stop, Reason :: any(), #state{}}.
 
 
 handle_call(Request, From, State) ->
 handle_call(Request, From, State) ->
-    error_logger:warning_msg("Received from ~p an unknown call message: ~p", [Request, From]),
+    error_logger:warning_msg("Received from ~p an unknown call message: ~p~n", [Request, From]),
     {reply, undefined, State}.
     {reply, undefined, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -109,7 +109,7 @@ handle_call(Request, From, State) ->
     {stop, Reason :: any(), #state{}}.
     {stop, Reason :: any(), #state{}}.
 
 
 handle_cast(Msg, State) ->
 handle_cast(Msg, State) ->
-    error_logger:warning_msg("Received an unknown cast message: ~p", [Msg]),
+    error_logger:warning_msg("Received an unknown cast message: ~p~n", [Msg]),
     {noreply, State}.
     {noreply, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -121,12 +121,12 @@ handle_cast(Msg, State) ->
     {stop, Reason :: any(), #state{}}.
     {stop, Reason :: any(), #state{}}.
 
 
 handle_info({mnesia_system_event, {inconsistent_database, Context, RemoteNode}}, State) ->
 handle_info({mnesia_system_event, {inconsistent_database, Context, RemoteNode}}, State) ->
-    error_logger:error_msg("MNESIA signalled an inconsistent database on node ~p for remote node ~p with context: ~p, initiating automerge", [node(), RemoteNode, Context]),
+    error_logger:error_msg("MNESIA signalled an inconsistent database on node ~p for remote node ~p with context: ~p, initiating automerge~n", [node(), RemoteNode, Context]),
     automerge(RemoteNode),
     automerge(RemoteNode),
     {noreply, State};
     {noreply, State};
 
 
 handle_info({mnesia_system_event, {mnesia_down, RemoteNode}}, State) when RemoteNode =/= node() ->
 handle_info({mnesia_system_event, {mnesia_down, RemoteNode}}, State) when RemoteNode =/= node() ->
-    error_logger:error_msg("Received a MNESIA down event, removing on node ~p all pids of node ~p", [node(), RemoteNode]),
+    error_logger:error_msg("Received a MNESIA down event, removing on node ~p all pids of node ~p~n", [node(), RemoteNode]),
     delete_registry_pids_of_disconnected_node(RemoteNode),
     delete_registry_pids_of_disconnected_node(RemoteNode),
     delete_groups_pids_of_disconnected_node(RemoteNode),
     delete_groups_pids_of_disconnected_node(RemoteNode),
     {noreply, State};
     {noreply, State};
@@ -139,12 +139,12 @@ handle_info({handle_purged_registry_double_processes, DoubleRegistryProcessesInf
     registry_conflicting_process_callback_module = RegistryConflictingProcessCallbackModule,
     registry_conflicting_process_callback_module = RegistryConflictingProcessCallbackModule,
     registry_conflicting_process_callback_function = RegistryConflictingProcessCallbackFunction
     registry_conflicting_process_callback_function = RegistryConflictingProcessCallbackFunction
 } = State) ->
 } = State) ->
-    error_logger:warning_msg("About to purge double processes after netsplit"),
+    error_logger:warning_msg("About to purge double processes after netsplit~n"),
     handle_purged_registry_double_processes(RegistryConflictingProcessCallbackModule, RegistryConflictingProcessCallbackFunction, DoubleRegistryProcessesInfo),
     handle_purged_registry_double_processes(RegistryConflictingProcessCallbackModule, RegistryConflictingProcessCallbackFunction, DoubleRegistryProcessesInfo),
     {noreply, State};
     {noreply, State};
 
 
 handle_info(Info, State) ->
 handle_info(Info, State) ->
-    error_logger:warning_msg("Received an unknown info message: ~p", [Info]),
+    error_logger:warning_msg("Received an unknown info message: ~p~n", [Info]),
     {noreply, State}.
     {noreply, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -152,7 +152,7 @@ handle_info(Info, State) ->
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
 -spec terminate(Reason :: any(), #state{}) -> terminated.
 -spec terminate(Reason :: any(), #state{}) -> terminated.
 terminate(Reason, _State) ->
 terminate(Reason, _State) ->
-    error_logger:info_msg("Terminating syn consistency with reason: ~p", [Reason]),
+    error_logger:info_msg("Terminating syn consistency with reason: ~p~n", [Reason]),
     terminated.
     terminated.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -194,9 +194,9 @@ automerge(RemoteNode) ->
     %% resolve conflicts
     %% resolve conflicts
     global:trans({{?MODULE, automerge}, self()},
     global:trans({{?MODULE, automerge}, self()},
         fun() ->
         fun() ->
-            error_logger:warning_msg("AUTOMERGE starting on node ~p for remote node ~p (global lock is set)", [node(), RemoteNode]),
+            error_logger:warning_msg("AUTOMERGE starting on node ~p for remote node ~p (global lock is set)~n", [node(), RemoteNode]),
             check_stitch(RemoteNode),
             check_stitch(RemoteNode),
-            error_logger:warning_msg("AUTOMERGE done (global lock about to be unset)")
+            error_logger:warning_msg("AUTOMERGE done (global lock about to be unset)~n")
         end
         end
     ),
     ),
     %% resume processes able to modify mnesia tables
     %% resume processes able to modify mnesia tables
@@ -207,13 +207,13 @@ automerge(RemoteNode) ->
 check_stitch(RemoteNode) ->
 check_stitch(RemoteNode) ->
     case catch lists:member(RemoteNode, mnesia:system_info(running_db_nodes)) of
     case catch lists:member(RemoteNode, mnesia:system_info(running_db_nodes)) of
         true ->
         true ->
-            error_logger:warning_msg("Remote node ~p is already stitched.", [RemoteNode]),
+            error_logger:warning_msg("Remote node ~p is already stitched.~n", [RemoteNode]),
             ok;
             ok;
         false ->
         false ->
             catch stitch(RemoteNode),
             catch stitch(RemoteNode),
             ok;
             ok;
         Error ->
         Error ->
-            error_logger:error_msg("Could not check if node is stiched: ~p", [Error]),
+            error_logger:error_msg("Could not check if node is stiched: ~p~n", [Error]),
             ok
             ok
     end.
     end.
 
 
@@ -358,7 +358,7 @@ write_groups_processes_info_to_node(Node, GroupsRegistryProcessesInfo) ->
 ) -> ok.
 ) -> ok.
 handle_purged_registry_double_processes(undefined, _, DoubleRegistryProcessesInfo) ->
 handle_purged_registry_double_processes(undefined, _, DoubleRegistryProcessesInfo) ->
     F = fun({Key, LocalProcessPid, _LocalProcessMeta}) ->
     F = fun({Key, LocalProcessPid, _LocalProcessMeta}) ->
-        error_logger:warning_msg("Found a double process for ~s, killing it on local node ~p", [Key, node()]),
+        error_logger:warning_msg("Found a double process for ~s, killing it on local node ~p~n", [Key, node()]),
         exit(LocalProcessPid, kill)
         exit(LocalProcessPid, kill)
     end,
     end,
     lists:foreach(F, DoubleRegistryProcessesInfo);
     lists:foreach(F, DoubleRegistryProcessesInfo);
@@ -366,7 +366,7 @@ handle_purged_registry_double_processes(RegistryConflictingProcessCallbackModule
     F = fun({Key, LocalProcessPid, LocalProcessMeta}) ->
     F = fun({Key, LocalProcessPid, LocalProcessMeta}) ->
         spawn(
         spawn(
             fun() ->
             fun() ->
-                error_logger:warning_msg("Found a double process for ~s, about to trigger callback on local node ~p", [Key, node()]),
+                error_logger:warning_msg("Found a double process for ~s, about to trigger callback on local node ~p~n", [Key, node()]),
                 RegistryConflictingProcessCallbackModule:RegistryConflictingProcessCallbackFunction(Key, LocalProcessPid, LocalProcessMeta)
                 RegistryConflictingProcessCallbackModule:RegistryConflictingProcessCallbackFunction(Key, LocalProcessPid, LocalProcessMeta)
             end
             end
         )
         )

+ 6 - 6
src/syn_groups.erl

@@ -213,7 +213,7 @@ handle_call({leave, Name, Pid}, _From, State) ->
     end;
     end;
 
 
 handle_call(Request, From, State) ->
 handle_call(Request, From, State) ->
-    error_logger:warning_msg("Received from ~p an unknown call message: ~p", [Request, From]),
+    error_logger:warning_msg("Received from ~p an unknown call message: ~p~n", [Request, From]),
     {reply, undefined, State}.
     {reply, undefined, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -225,7 +225,7 @@ handle_call(Request, From, State) ->
     {stop, Reason :: any(), #state{}}.
     {stop, Reason :: any(), #state{}}.
 
 
 handle_cast(Msg, State) ->
 handle_cast(Msg, State) ->
-    error_logger:warning_msg("Received an unknown cast message: ~p", [Msg]),
+    error_logger:warning_msg("Received an unknown cast message: ~p~n", [Msg]),
     {noreply, State}.
     {noreply, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -250,7 +250,7 @@ handle_info({'EXIT', Pid, Reason}, #state{
                 {shutdown, _} -> ok;
                 {shutdown, _} -> ok;
                 killed -> ok;
                 killed -> ok;
                 _ ->
                 _ ->
-                    error_logger:error_msg("Received an exit message from an unlinked process ~p with reason: ~p", [Pid, Reason])
+                    error_logger:error_msg("Received an exit message from an unlinked process ~p with reason: ~p~n", [Pid, Reason])
             end;
             end;
         
         
         Processes ->
         Processes ->
@@ -265,7 +265,7 @@ handle_info({'EXIT', Pid, Reason}, #state{
                     {shutdown, _} -> ok;
                     {shutdown, _} -> ok;
                     killed -> ok;
                     killed -> ok;
                     _ ->
                     _ ->
-                        error_logger:error_msg("Process of group ~p and pid ~p exited with reason: ~p", [Name, Pid, Reason])
+                        error_logger:error_msg("Process of group ~p and pid ~p exited with reason: ~p~n", [Name, Pid, Reason])
                 end,
                 end,
                 %% delete from table
                 %% delete from table
                 remove_process(Process),
                 remove_process(Process),
@@ -286,7 +286,7 @@ handle_info({'EXIT', Pid, Reason}, #state{
     {noreply, State};
     {noreply, State};
 
 
 handle_info(Info, State) ->
 handle_info(Info, State) ->
-    error_logger:warning_msg("Received an unknown info message: ~p", [Info]),
+    error_logger:warning_msg("Received an unknown info message: ~p~n", [Info]),
     {noreply, State}.
     {noreply, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -294,7 +294,7 @@ handle_info(Info, State) ->
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
 -spec terminate(Reason :: any(), #state{}) -> terminated.
 -spec terminate(Reason :: any(), #state{}) -> terminated.
 terminate(Reason, _State) ->
 terminate(Reason, _State) ->
-    error_logger:info_msg("Terminating syn_groups with reason: ~p", [Reason]),
+    error_logger:info_msg("Terminating syn_groups with reason: ~p~n", [Reason]),
     terminated.
     terminated.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------

+ 6 - 6
src/syn_registry.erl

@@ -204,7 +204,7 @@ handle_call({unlink_process, Pid}, _From, State) ->
     {reply, ok, State};
     {reply, ok, State};
 
 
 handle_call(Request, From, State) ->
 handle_call(Request, From, State) ->
-    error_logger:warning_msg("Received from ~p an unknown call message: ~p", [Request, From]),
+    error_logger:warning_msg("Received from ~p an unknown call message: ~p~n", [Request, From]),
     {reply, undefined, State}.
     {reply, undefined, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -216,7 +216,7 @@ handle_call(Request, From, State) ->
     {stop, Reason :: any(), #state{}}.
     {stop, Reason :: any(), #state{}}.
 
 
 handle_cast(Msg, State) ->
 handle_cast(Msg, State) ->
-    error_logger:warning_msg("Received an unknown cast message: ~p", [Msg]),
+    error_logger:warning_msg("Received an unknown cast message: ~p~n", [Msg]),
     {noreply, State}.
     {noreply, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -241,7 +241,7 @@ handle_info({'EXIT', Pid, Reason}, #state{
                 {shutdown, _} -> ok;
                 {shutdown, _} -> ok;
                 killed -> ok;
                 killed -> ok;
                 _ ->
                 _ ->
-                    error_logger:error_msg("Received an exit message from an unlinked process ~p with reason: ~p", [Pid, Reason])
+                    error_logger:error_msg("Received an exit message from an unlinked process ~p with reason: ~p~n", [Pid, Reason])
             end,
             end,
             
             
             %% return
             %% return
@@ -260,7 +260,7 @@ handle_info({'EXIT', Pid, Reason}, #state{
                 {shutdown, _} -> ok;
                 {shutdown, _} -> ok;
                 killed -> ok;
                 killed -> ok;
                 _ ->
                 _ ->
-                    error_logger:error_msg("Process with key ~p and pid ~p exited with reason: ~p", [Key0, Pid, Reason])
+                    error_logger:error_msg("Process with key ~p and pid ~p exited with reason: ~p~n", [Key0, Pid, Reason])
             end,
             end,
             
             
             %% delete from table
             %% delete from table
@@ -284,7 +284,7 @@ handle_info({'EXIT', Pid, Reason}, #state{
     {noreply, State};
     {noreply, State};
 
 
 handle_info(Info, State) ->
 handle_info(Info, State) ->
-    error_logger:warning_msg("Received an unknown info message: ~p", [Info]),
+    error_logger:warning_msg("Received an unknown info message: ~p~n", [Info]),
     {noreply, State}.
     {noreply, State}.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
@@ -292,7 +292,7 @@ handle_info(Info, State) ->
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------
 -spec terminate(Reason :: any(), #state{}) -> terminated.
 -spec terminate(Reason :: any(), #state{}) -> terminated.
 terminate(Reason, _State) ->
 terminate(Reason, _State) ->
-    error_logger:info_msg("Terminating syn_registry with reason: ~p", [Reason]),
+    error_logger:info_msg("Terminating syn_registry with reason: ~p~n", [Reason]),
     terminated.
     terminated.
 
 
 %% ----------------------------------------------------------------------------------------------------------
 %% ----------------------------------------------------------------------------------------------------------