Allow for run-time changes to log_level and forced_logs

Will not lead to immediate run time changes in SST or CDB logs.  These log settings will only change once the new files are re-written.

To completely change the log level - a restart of the store is necessary with new startup options.
This commit is contained in:
Martin Sumner 2018-12-11 21:59:57 +00:00
parent 6677f2e5c6
commit 672cfd4fcd
7 changed files with 239 additions and 16 deletions

View file

@ -15,7 +15,8 @@
add_forcedlogs/1,
remove_forcedlogs/1,
get_opts/0,
save/1]).
save/1,
return_settings/0]).
-record(log_options, {log_level = info :: log_level(),
@ -24,7 +25,7 @@
-type log_level() :: debug | info | warn | error | critical.
-type log_options() :: #log_options{}.
-export_type([log_options/0]).
-export_type([log_options/0, log_level/0]).
-define(LOG_LEVELS, [debug, info, warn, error, critical]).
-define(DEFAULT_LOG_LEVEL, error).
@ -442,6 +443,12 @@ get_opts() ->
forced_logs = []}
end.
-spec return_settings() -> {log_level(), list(string())}.
%% @doc
%% Return the settings outside of the record
return_settings() ->
LO = get_opts(),
{LO#log_options.log_level, LO#log_options.forced_logs}.
%%%============================================================================
%%% Prompt Logs