rename the fmt mode to human

This commit is contained in:
Tamo 2024-02-08 13:59:30 +01:00 committed by Louis Dureuil
parent 35aa9d5904
commit 2c88131bb1
No known key found for this signature in database
3 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
#[deserr(rename_all = lowercase)] #[deserr(rename_all = lowercase)]
pub enum LogMode { pub enum LogMode {
#[default] #[default]
Fmt, Human,
Profile, Profile,
} }
@ -160,7 +160,7 @@ fn make_layer<
) -> (Box<dyn Layer<S> + Send + Sync>, PinnedByteStream) { ) -> (Box<dyn Layer<S> + Send + Sync>, PinnedByteStream) {
let guard = HandleGuard { logs: logs.into_inner() }; let guard = HandleGuard { logs: logs.into_inner() };
match opt.mode { match opt.mode {
LogMode::Fmt => { LogMode::Human => {
let (sender, receiver) = tokio::sync::mpsc::unbounded_channel(); let (sender, receiver) = tokio::sync::mpsc::unbounded_channel();
let fmt_layer = tracing_subscriber::fmt::layer() let fmt_layer = tracing_subscriber::fmt::layer()

View File

@ -89,7 +89,7 @@ async fn logs_stream_bad_mode() {
snapshot!(code, @"400 Bad Request"); snapshot!(code, @"400 Bad Request");
snapshot!(response, @r###" snapshot!(response, @r###"
{ {
"message": "Unknown value `tamo` at `.mode`: expected one of `fmt`, `profile`", "message": "Unknown value `tamo` at `.mode`: expected one of `human`, `profile`",
"code": "bad_request", "code": "bad_request",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#bad_request" "link": "https://docs.meilisearch.com/errors#bad_request"
@ -133,7 +133,7 @@ async fn logs_stream_bad_profile_memory() {
snapshot!(code, @"400 Bad Request"); snapshot!(code, @"400 Bad Request");
snapshot!(response, @r###" snapshot!(response, @r###"
{ {
"message": "Invalid value: `profile_memory` can only be used while profiling code and is not compatible with the Fmt mode.", "message": "Invalid value: `profile_memory` can only be used while profiling code and is not compatible with the Human mode.",
"code": "invalid_settings_typo_tolerance", "code": "invalid_settings_typo_tolerance",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_settings_typo_tolerance" "link": "https://docs.meilisearch.com/errors#invalid_settings_typo_tolerance"
@ -146,10 +146,10 @@ async fn logs_stream_bad_profile_memory() {
snapshot!(code, @"400 Bad Request"); snapshot!(code, @"400 Bad Request");
snapshot!(response, @r###" snapshot!(response, @r###"
{ {
"message": "Invalid value: `profile_memory` can only be used while profiling code and is not compatible with the Fmt mode.", "message": "Unknown value `fmt` at `.mode`: expected one of `human`, `profile`",
"code": "invalid_settings_typo_tolerance", "code": "bad_request",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_settings_typo_tolerance" "link": "https://docs.meilisearch.com/errors#bad_request"
} }
"###); "###);
} }

View File

@ -57,7 +57,7 @@ async fn basic_test_log_stream_route() {
.insert_header(ContentType::json()) .insert_header(ContentType::json())
.set_payload( .set_payload(
serde_json::to_vec(&json!({ serde_json::to_vec(&json!({
"mode": "fmt", "mode": "human",
"target": "info", "target": "info",
})) }))
.unwrap(), .unwrap(),