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
end end
# WIP: select (dynamically) messages to mask
module DNSManager 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 enum MESSAGE
KEEPALIVE KEEPALIVE
# TODO USETOKEN
end end
end end
@ -155,6 +155,7 @@ class DNSManager::Service < IPC
Response::Error.new "generic error" Response::Error.new "generic error"
end end
respname = response.class.name.sub /^DNSManager::Response::/, ""
# If clients sent requests with an “id” field, it is copied # If clients sent requests with an “id” field, it is copied
# in the responses. Allows identifying responses easily. # in the responses. Allows identifying responses easily.
response.id = request.id response.id = request.id
@ -166,9 +167,11 @@ class DNSManager::Service < IPC
if response.is_a? DNSManager::Response::Error if response.is_a? DNSManager::Response::Error
Baguette::Log.warning "(#{connection_info_str}) (#{duration}) #{request} >> #{response}" Baguette::Log.warning "(#{connection_info_str}) (#{duration}) #{request} >> #{response}"
else else
if reqname != "KeepAlive" || should_display? DNSMESSAGE::KEEPALIVE # Different cases where we want to simply avoid logging redundant messages.
Baguette::Log.debug "(#{connection_info_str}) (#{duration}) #{request} >> #{response}" return if reqname == "KeepAlive" && ! should_display? DNSMESSAGE::KEEPALIVE
end return if reqname == "UseToken" && respname == "Success" && ! should_display? DNSMESSAGE::USETOKEN
Baguette::Log.debug "(#{connection_info_str}) (#{duration}) #{request} >> #{response}"
end end
end end