mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: api: Log HTTP API error responses
Although a response is sent to the client these errors are not logged in the log file making it hard to cross reference these with other log entries. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -15,7 +15,7 @@ use std::sync::mpsc::Sender;
|
||||
use std::thread;
|
||||
|
||||
use hypervisor::HypervisorType;
|
||||
use log::error;
|
||||
use log::{error, info};
|
||||
use micro_http::{
|
||||
Body, HttpServer, MediaType, Method, Request, Response, ServerError, StatusCode, Version,
|
||||
};
|
||||
@@ -90,6 +90,8 @@ pub fn error_response(error: HttpError, status: StatusCode) -> Response {
|
||||
.map(|error| format!("{error}"))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
info!("HTTP API error response: {}", error_messages.join(": "));
|
||||
|
||||
// TODO: Move `api` module from `vmm` to dedicated crate and use a common type definition
|
||||
let json = serde_json::to_string(&error_messages).unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user