Fix log messages.

This commit is contained in:
Philippe Pittoli 2023-05-08 19:34:57 +02:00
parent f60530750b
commit 35428314b5

View File

@ -89,7 +89,7 @@ class DNSManager::Storage
Response::Success.new
rescue e
Baguette::Log.error "trying to add -or update- zone #{zone.domain}: #{e}"
Response::Error.new "error while updating the domain #{zone.domain}"
Response::Error.new "error while adding or updating the domain #{zone.domain}"
end
def add_rr(user_id : Int32, domain : String, rr : Zone::ResourceRecord) : IPC::JSON
@ -115,7 +115,7 @@ class DNSManager::Storage
# Test RR validity.
rr.get_errors.tap do |errors|
unless errors.empty?
Baguette::Log.warning "Add RR with errors: #{errors}"
Baguette::Log.warning "add RR with errors: #{errors}"
return Response::InvalidZone.new errors
end
end
@ -135,7 +135,7 @@ class DNSManager::Storage
# User must exist.
user_data = user_data_by_uid.get? user_id.to_s
unless user_data
Baguette::Log.warning "unknown user #{user_id} tries to add -or update- zone #{domain}"
Baguette::Log.warning "unknown user #{user_id} tries to update a RR in domain #{domain}"
return Response::UnknownUser.new
end
@ -174,7 +174,7 @@ class DNSManager::Storage
# User must exist.
user_data = user_data_by_uid.get? user_id.to_s
unless user_data
Baguette::Log.warning "unknown user #{user_id} tries to add -or update- zone #{domain}"
Baguette::Log.warning "unknown user #{user_id} tries to delete a RR in domain #{domain}"
return Response::UnknownUser.new
end
@ -197,8 +197,8 @@ class DNSManager::Storage
Response::Success.new
rescue e
Baguette::Log.error "trying to replace a resource record in domain #{domain}: #{e}"
Response::Error.new "error while replacing a resource record in domain #{domain}"
Baguette::Log.error "trying to remove a resource record in domain #{domain}: #{e}"
Response::Error.new "error while removing a resource record in domain #{domain}"
end
def delete_domain(user_id : Int32, domain : String) : IPC::JSON
@ -265,7 +265,7 @@ class DNSManager::Storage
Response::DomainList.new user_data.domains
rescue e
Baguette::Log.error "while listing all user #{user_id} domains: #{e}"
Baguette::Log.error "trying to list all user #{user_id} domains: #{e}"
Response::Error.new "error while listing domains"
end
end