diff options
author | Péter Dimitrov <[email protected]> | 2018-06-15 16:39:15 +0200 |
---|---|---|
committer | Péter Dimitrov <[email protected]> | 2018-06-20 15:18:37 +0200 |
commit | e94c5fad7304aa7b5cd15646a1fd246aae460a3f (patch) | |
tree | 742e05aad84dfeeaced4b6fcbab5b2116a70c9f0 /lib/ssl/src | |
parent | eae3952b4af6c3afff39dd0dd5e6b72291566b4a (diff) | |
download | otp-e94c5fad7304aa7b5cd15646a1fd246aae460a3f.tar.gz otp-e94c5fad7304aa7b5cd15646a1fd246aae460a3f.tar.bz2 otp-e94c5fad7304aa7b5cd15646a1fd246aae460a3f.zip |
ssl: Update domain filter, use log macros
Change-Id: Id52990a105c81373c7c6034df9a2675f9d0e429a
Diffstat (limited to 'lib/ssl/src')
-rw-r--r-- | lib/ssl/src/ssl_app.erl | 4 | ||||
-rw-r--r-- | lib/ssl/src/ssl_connection.erl | 4 | ||||
-rw-r--r-- | lib/ssl/src/tls_connection.erl | 15 | ||||
-rw-r--r-- | lib/ssl/src/tls_handshake.erl | 6 | ||||
-rw-r--r-- | lib/ssl/src/tls_record.erl | 9 |
5 files changed, 20 insertions, 18 deletions
diff --git a/lib/ssl/src/ssl_app.erl b/lib/ssl/src/ssl_app.erl index d1bd113b0d..1beaa513b4 100644 --- a/lib/ssl/src/ssl_app.erl +++ b/lib/ssl/src/ssl_app.erl @@ -39,10 +39,10 @@ stop(_State) -> %% %% Description: Start SSL logger start_logger() -> - Config = #{level => info, + Config = #{level => debug, filter_default => stop, formatter => {logger_ssl_formatter, #{}}}, - Filter = {fun logger_filters:domain/2,{log,starts_with,[beam,erlang,otp,ssl]}}, + Filter = {fun logger_filters:domain/2,{log,sub,[otp,ssl]}}, logger:add_handler(ssl_handler, logger_std_h, Config), logger:add_handler_filter(ssl_handler, filter_non_ssl, Filter). diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl index 271365b709..bfb83343d8 100644 --- a/lib/ssl/src/ssl_connection.erl +++ b/lib/ssl/src/ssl_connection.erl @@ -342,7 +342,7 @@ handle_own_alert(Alert, Version, StateName, protocol => 'tls_record', message => BinMsg, version => Version}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}) + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}) catch _:_ -> %% Can crash if we are in a uninitialized state ignore end, @@ -450,7 +450,7 @@ write_application_data(Data0, {FromPid, _} = From, protocol => 'tls_record', message => Msgs, version => Version}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), RetVal end. diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl index f1291ec7b4..071f464851 100644 --- a/lib/ssl/src/tls_connection.erl +++ b/lib/ssl/src/tls_connection.erl @@ -38,7 +38,8 @@ -include("ssl_api.hrl"). -include("ssl_internal.hrl"). -include("ssl_srp.hrl"). --include_lib("public_key/include/public_key.hrl"). +-include_lib("public_key/include/public_key.hrl"). +-include_lib("kernel/include/logger.hrl"). %% Internal application API @@ -274,8 +275,8 @@ queue_handshake(Handshake, #state{negotiated_version = Version, HandshakeMsg = #{direction => outbound, protocol => 'handshake', message => Handshake}, - logger:info(HandshakeMsg, #{domain => [beam,erlang,otp,ssl,handshake]}), - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(HandshakeMsg, #{domain => [otp,ssl,handshake]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), State0#state{connection_states = ConnectionStates, tls_handshake_history = Hist, flight_buffer = Flight0 ++ [BinHandshake]}. @@ -294,7 +295,7 @@ queue_change_cipher(Msg, #state{negotiated_version = Version, Report = #{direction => outbound, protocol => 'tls_record', message => BinChangeCipher}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), State0#state{connection_states = ConnectionStates, flight_buffer = Flight0 ++ [BinChangeCipher]}. @@ -330,7 +331,7 @@ send_alert(Alert, #state{negotiated_version = Version, Report = #{direction => outbound, protocol => 'tls_record', message => BinMsg}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), State0#state{connection_states = ConnectionStates}. @@ -440,8 +441,8 @@ init({call, From}, {start, Timeout}, HelloMsg = #{direction => outbound, protocol => 'handshake', message => Hello}, - logger:info(HelloMsg, #{domain => [beam,erlang,otp,ssl,handshake]}), - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(HelloMsg, #{domain => [otp,ssl,handshake]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), State1 = State0#state{connection_states = ConnectionStates, negotiated_version = Version, %% Requested version session = diff --git a/lib/ssl/src/tls_handshake.erl b/lib/ssl/src/tls_handshake.erl index 42b457d24a..4aed414b6d 100644 --- a/lib/ssl/src/tls_handshake.erl +++ b/lib/ssl/src/tls_handshake.erl @@ -31,6 +31,7 @@ -include("ssl_internal.hrl"). -include("ssl_cipher.hrl"). -include_lib("public_key/include/public_key.hrl"). +-include_lib("kernel/include/logger.hrl"). %% Handshake handling -export([client_hello/8, hello/4]). @@ -274,9 +275,8 @@ get_tls_handshake_aux(Version, <<?BYTE(Type), ?UINT24(Length), Handshake -> Report = #{direction => inbound, protocol => 'handshake', - message => Handshake, - version => Version}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,handshake]}), + message => Handshake}, + ?LOG_DEBUG(Report, #{domain => [otp,ssl,handshake]}), get_tls_handshake_aux(Version, Rest, Opts, [{Handshake,Raw} | Acc]) catch _:_ -> diff --git a/lib/ssl/src/tls_record.erl b/lib/ssl/src/tls_record.erl index 05c5d703a9..b744555753 100644 --- a/lib/ssl/src/tls_record.erl +++ b/lib/ssl/src/tls_record.erl @@ -30,6 +30,7 @@ -include("ssl_alert.hrl"). -include("tls_handshake.hrl"). -include("ssl_cipher.hrl"). +-include_lib("kernel/include/logger.hrl"). %% Handling of incoming data -export([get_tls_records/3, init_connection_states/2]). @@ -405,7 +406,7 @@ get_tls_records_aux(<<?BYTE(?APPLICATION_DATA),?BYTE(MajVer),?BYTE(MinVer), Report = #{direction => inbound, protocol => 'tls_record', message => [RawTLSRecord]}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), get_tls_records_aux(Rest, [#ssl_tls{type = ?APPLICATION_DATA, version = {MajVer, MinVer}, fragment = Data} | Acc]); @@ -417,7 +418,7 @@ get_tls_records_aux(<<?BYTE(?HANDSHAKE),?BYTE(MajVer),?BYTE(MinVer), Report = #{direction => inbound, protocol => 'tls_record', message => [RawTLSRecord]}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), get_tls_records_aux(Rest, [#ssl_tls{type = ?HANDSHAKE, version = {MajVer, MinVer}, fragment = Data} | Acc]); @@ -429,7 +430,7 @@ get_tls_records_aux(<<?BYTE(?ALERT),?BYTE(MajVer),?BYTE(MinVer), Report = #{direction => inbound, protocol => 'tls_record', message => [RawTLSRecord]}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), get_tls_records_aux(Rest, [#ssl_tls{type = ?ALERT, version = {MajVer, MinVer}, fragment = Data} | Acc]); @@ -441,7 +442,7 @@ get_tls_records_aux(<<?BYTE(?CHANGE_CIPHER_SPEC),?BYTE(MajVer),?BYTE(MinVer), Report = #{direction => inbound, protocol => 'tls_record', message => [RawTLSRecord]}, - logger:info(Report, #{domain => [beam,erlang,otp,ssl,tls_record]}), + ?LOG_DEBUG(Report, #{domain => [otp,ssl,tls_record]}), get_tls_records_aux(Rest, [#ssl_tls{type = ?CHANGE_CIPHER_SPEC, version = {MajVer, MinVer}, fragment = Data} | Acc]); |