Commit 3e0c2a24 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Log at info level the success of a luxi query



So far, any successful query was only logged at debug level, thus leaving
no traces in the logs, unless debugging was enabled. Therefore, we add
a notes about successful completion at info level. Also, repeat a failed
request at WARN level, so that, even if debugging disabled, the request
is available together with the error message in the logs.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 61f3d56e
......@@ -175,7 +175,6 @@ handleCall _ op =
return . Bad $
GenericError ("Luxi call '" ++ strOfOp op ++ "' not implemented")
-- | Given a decoded luxi request, executes it and sends the luxi
-- response back to the client.
handleClientMsg :: Client -> ConfigReader -> LuxiOp -> IO Bool
......@@ -186,11 +185,13 @@ handleClientMsg client creader args = do
(!status, !rval) <-
case call_result of
Bad err -> do
logWarning $ "Failed to execute request: " ++ show err
logWarning $ "Failed to execute request " ++ show args ++ ": "
++ show err
return (False, showJSON err)
Ok result -> do
-- only log the first 2,000 chars of the result
logDebug $ "Result (truncated): " ++ take 2000 (J.encode result)
logInfo $ "Successfully handled " ++ strOfOp args
return (True, result)
sendMsg client $ buildResponse status rval
return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment