diff options
author | Hubert Plociniczak <hubert@lshift.net> | 2008-08-26 18:26:04 +0100 |
---|---|---|
committer | Hubert Plociniczak <hubert@lshift.net> | 2008-08-26 18:26:04 +0100 |
commit | 475a336f0982fb1f433990ca4b2e98c331ba720a (patch) | |
tree | 34b99adc4422b522e9d7b6d0ecfb5dac304f851f /src/rabbit_sasl_report_file_h.erl | |
parent | 433b04ce96873023190557df81f570afd3999c5e (diff) | |
download | rabbitmq-server-475a336f0982fb1f433990ca4b2e98c331ba720a.tar.gz |
Moved append operation inside init/1
in handlers' wrappers. Added comments,
fixed various small things.
Diffstat (limited to 'src/rabbit_sasl_report_file_h.erl')
-rw-r--r-- | src/rabbit_sasl_report_file_h.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rabbit_sasl_report_file_h.erl b/src/rabbit_sasl_report_file_h.erl index 7bfa2ca1..eb5bf091 100644 --- a/src/rabbit_sasl_report_file_h.erl +++ b/src/rabbit_sasl_report_file_h.erl @@ -29,6 +29,21 @@ -export([init/1, handle_event/2, handle_call/2, handle_info/2, terminate/2, code_change/3]). +%% rabbit_sasl_report_file_h is a wrapper around sasl_report_file_h +%% module because the original's init/1 does not match properly +%% with the result of closing the old handler when swapping handlers. +%% The first init/1 additionally allows for simple log rotation +%% when suffix is not "" + +%% Used only when swapping handlers and performing +%% log rotation +init({{File, Suffix}, []}) -> + case rabbit_misc:append_file(File, Suffix) of + ok -> sasl_report_file_h:init({File, sasl_error_logger_type()}); + Error -> Error + end; +%% Used only when swapping handlers without +%% doing any log rotation init({File, []}) -> sasl_report_file_h:init({File, sasl_error_logger_type()}); init({_File, _Type} = FileInfo) -> @@ -51,6 +66,8 @@ terminate(Reason, State) -> code_change(OldVsn, State, Extra) -> sasl_report_file_h:code_change(OldVsn, State, Extra). +%%---------------------------------------------------------------------- + sasl_error_logger_type() -> case application:get_env(sasl, errlog_type) of {ok, error} -> error; |