Ignore UseToken.

This commit is contained in:
Philippe Pittoli 2024-12-17 01:22:20 +01:00
parent f92cadf634
commit 7f6a04e89e

View File

@ -10,12 +10,12 @@ class Array(T)
end
end
# WIP: select (dynamically) messages to mask
module DNSManager
# Select messages to mask in the logs (when everything goes well, of course).
# No need to flood the logs with keepalive messages or periodic token use, for instance.
enum MESSAGE
KEEPALIVE
# TODO
USETOKEN
end
end
@ -155,6 +155,7 @@ class DNSManager::Service < IPC
Response::Error.new "generic error"
end
respname = response.class.name.sub /^DNSManager::Response::/, ""
# If clients sent requests with an “id” field, it is copied
# in the responses. Allows identifying responses easily.
response.id = request.id
@ -166,9 +167,11 @@ class DNSManager::Service < IPC
if response.is_a? DNSManager::Response::Error
Baguette::Log.warning "(#{connection_info_str}) (#{duration}) #{request} >> #{response}"
else
if reqname != "KeepAlive" || should_display? DNSMESSAGE::KEEPALIVE
Baguette::Log.debug "(#{connection_info_str}) (#{duration}) #{request} >> #{response}"
end
# Different cases where we want to simply avoid logging redundant messages.
return if reqname == "KeepAlive" && ! should_display? DNSMESSAGE::KEEPALIVE
return if reqname == "UseToken" && respname == "Success" && ! should_display? DNSMESSAGE::USETOKEN
Baguette::Log.debug "(#{connection_info_str}) (#{duration}) #{request} >> #{response}"
end
end