Skip to content

Conversation

@0xAX
Copy link
Member

@0xAX 0xAX commented Apr 28, 2025

This commit provides the following improvements for the logging:

  1. Switch to info from debug in the logging messages for the incoming requests and outgoing responses. There is no big sense in these messages anyway if everything is normal but more useful during debugging process.
  2. Add logging to the RADIUS client if hostname can not be resolved. The log messages are added only to the place where we handle secondary/failover RADIUS servers to not spam with such messages.
  3. Remove additional log message for the outgoing response. We already have such message from the point 1 which has everything what the removed message had except the RADIUS server name.

@0xAX 0xAX requested a review from a team as a code owner April 28, 2025 13:19
Comment on lines 438 to 446
try
IP = get_ip(Addr),
ets:insert(?MODULE, {{IP, Port}, Retries, Retries})
catch error:badarg ->
?LOG(error, "Can't resolve hostname - ~p", [Addr])
end;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that other places use the try around get_ip too, but that is just because get_ip/1 is not really the right fit for those.
It would IMHO be far better to change the return of get_ip/1 to {ok, IP}|{error, Error} and change the 3 places in this file that use it to handle that return properly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it but as get_ip is a part of public API I decided to not changeat least in this PR to not affect potential callers

RoadRunnr
RoadRunnr previously approved these changes Apr 28, 2025
Copy link
Member

@RoadRunnr RoadRunnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved as is, although I would prefer if you could change the try around get_ip

This commit provides the following improvements for the logging:

1. Switch to info from debug in the logging messages for the incoming
requests and outgoing responses. There is no big sense in these
messages anyway if everything is normal but more useful during
debugging process.
2. Add logging to the RADIUS client if hostname can not be
resolved. The log messages are added only to the place where we handle
secondary/failover RADIUS servers to not spam with such messages.
3. Remove additional log message for the outgoing response. We already
have such message from the point 1 which has everything what the
removed message had except the RADIUS server name.
@0xAX 0xAX merged commit 8224a4a into master Apr 29, 2025
4 of 5 checks passed
@0xAX 0xAX deleted the improve-logging branch April 29, 2025 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants