summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2019-09-25 11:28:42 +0300
committerMichael Klishin <michael@clojurewerkz.org>2019-09-25 11:28:42 +0300
commitea79b7956d02833a79a7b4fe9dccb8ff3f3c9180 (patch)
tree77e0933cc5057453f7c58d4b3dd4c08fe1b704eb
parent697e0061adb6f10ed254a8c0702d4dad105a1fc1 (diff)
downloadrabbitmq-server-git-ea79b7956d02833a79a7b4fe9dccb8ff3f3c9180.tar.gz
Startup banner improvements
Include config file paths and doco links.
-rw-r--r--src/rabbit.erl36
-rw-r--r--src/rabbit_config.erl5
-rw-r--r--src/rabbit_lager.erl4
3 files changed, 31 insertions, 14 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 7095966ced..5b13f8d238 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -267,8 +267,7 @@
%%----------------------------------------------------------------------------
-type restart_type() :: 'permanent' | 'transient' | 'temporary'.
-%% this really should be an abstract type
--type log_location() :: string().
+
-type param() :: atom().
-type app_name() :: atom().
@@ -1124,11 +1123,14 @@ start_logger() ->
rabbit_lager:start_logger(),
ok.
--spec log_locations() -> [log_location()].
-
+-spec log_locations() -> [rabbit_lager:log_location()].
log_locations() ->
rabbit_lager:log_locations().
+-spec config_locations() -> [rabbit_config:config_location()].
+config_locations() ->
+ rabbit_config:config_files().
+
-spec force_event_refresh(reference()) -> 'ok'.
% Note: https://www.pivotaltracker.com/story/show/166962656
@@ -1175,24 +1177,30 @@ erts_version_check() ->
print_banner() ->
{ok, Product} = application:get_key(description),
{ok, Version} = application:get_key(vsn),
- {LogFmt, LogLocations} = case log_locations() of
- [_ | Tail] = LL ->
- LF = lists:flatten(["~n ~ts"
- || _ <- lists:seq(1, length(Tail))]),
- {LF, LL};
- [] ->
- {"", ["(none)"]}
+ LineListFormatter = fun (Placeholder, [_ | Tail] = LL) ->
+ LF = lists:flatten([Placeholder || _ <- lists:seq(1, length(Tail))]),
+ {LF, LL};
+ (_, []) ->
+ {"", ["(none)"]}
end,
+ %% padded list lines
+ {LogFmt, LogLocations} = LineListFormatter("~n ~ts", log_locations()),
+ {CfgFmt, CfgLocations} = LineListFormatter("~n ~ts", config_locations()),
io:format("~n ## ##"
"~n ## ## ~s ~s. ~s"
"~n ########## ~s"
"~n ###### ##"
- "~n ########## Logs: ~ts" ++
- LogFmt ++
+ "~n ########## Logs: ~ts" ++ LogFmt ++ "~n"
+ "~n Config file(s): ~ts" ++ CfgFmt ++ "~n"
+ "~n Tutorials: https://rabbitmq.com/getstarted.html"
+ "~n Doc guides: https://rabbitmq.com/documentation.html"
+ "~n Monitoring: https://rabbitmq.com/monitoring.html"
+ "~n Get help: https://rabbitmq.com/contact.html"
"~n~n Starting broker..."
"~n",
[Product, Version, ?COPYRIGHT_MESSAGE, ?INFORMATION_MESSAGE] ++
- LogLocations).
+ LogLocations ++
+ CfgLocations).
log_banner() ->
{FirstLog, OtherLogs} = case log_locations() of
diff --git a/src/rabbit_config.erl b/src/rabbit_config.erl
index a3b7ad5657..6a2cc5c663 100644
--- a/src/rabbit_config.erl
+++ b/src/rabbit_config.erl
@@ -11,6 +11,10 @@
validate_config_files/0
]).
+-export_type([config_location/0]).
+
+-type config_location() :: string().
+
prepare_and_use_config() ->
case legacy_erlang_term_config_used() of
true ->
@@ -192,6 +196,7 @@ prepare_plugin_schemas(SchemaDir) ->
false -> ok
end.
+-spec config_files() -> [config_location()].
config_files() ->
case legacy_erlang_term_config_used() of
true ->
diff --git a/src/rabbit_lager.erl b/src/rabbit_lager.erl
index b1baa9306e..339394d123 100644
--- a/src/rabbit_lager.erl
+++ b/src/rabbit_lager.erl
@@ -25,6 +25,10 @@
%% For test purposes
-export([configure_lager/0]).
+-export_type([log_location/0]).
+
+-type log_location() :: string().
+
start_logger() ->
ok = maybe_remove_logger_handler(),
ok = app_utils:stop_applications([lager, syslog]),