diff --git a/src/service.cr b/src/service.cr index 1bd9da7..9d9c95a 100644 --- a/src/service.cr +++ b/src/service.cr @@ -111,23 +111,20 @@ class AuthD::Service < IPC end request_name = request.class.name.sub /^AuthD::Request::/, "" - if request_name != "KeepAlive" || @configuration.print_keepalive - Baguette::Log.debug "<< #{request_name} (FROM: #{event.fd})" - end response = begin request.handle self, event.fd rescue e : UserNotFound - Baguette::Log.error "#{request_name} user not found" + Baguette::Log.error "(fd #{ "%4d" % event.fd}) #{request_name} user not found" AuthD::Response::Error.new "authorization error" rescue e : AuthenticationInfoLacking - Baguette::Log.error "#{request_name} lacking authentication info" + Baguette::Log.error "(fd #{ "%4d" % event.fd}) #{request_name} lacking authentication info" AuthD::Response::Error.new "authorization error" rescue e : AdminAuthorizationException - Baguette::Log.error "#{request_name} admin authentication failed" + Baguette::Log.error "(fd #{ "%4d" % event.fd}) #{request_name} admin authentication failed" AuthD::Response::Error.new "authorization error" rescue e - Baguette::Log.error "#{request_name} generic error #{e}" + Baguette::Log.error "(fd #{ "%4d" % event.fd}) #{request_name} generic error #{e}" AuthD::Response::Error.new "unknown error" end @@ -142,10 +139,10 @@ class AuthD::Service < IPC response_name = response.class.name.sub /^AuthD::Response::/, "" if response.is_a? AuthD::Response::Error - Baguette::Log.warning ">> #{response_name} (#{response.reason}) (TO: #{event.fd})" + Baguette::Log.warning "fd #{ "%4d" % event.fd} (#{duration}) #{request_name} >> #{response_name} (#{response.reason})" else if request_name != "KeepAlive" || @configuration.print_keepalive - Baguette::Log.debug ">> #{response_name} (TO: #{event.fd}) (Total duration: #{duration})" + Baguette::Log.debug "fd #{ "%4d" % event.fd} (#{duration}) #{request_name} >> #{response_name}" end end end