use db::Pool;
use rocket::{self, Rocket, Request};
use rocket_contrib::{JSON, Value};
use std::env;

mod teams;
mod members;

pub fn app(pool: Pool) -> Rocket {
    set_log_level();
    rocket::ignite()
        .manage(pool)
        .mount("/teams", teams::routes())
        .mount("/members", members::routes())
        .catch(errors![not_found, server_error])
}

#[error(404)]
fn not_found(_req: &Request) -> JSON<Value> {
    JSON(json!({ "message": "Not Found" }))
}

#[error(500)]
fn server_error(_req: &Request) -> JSON<Value> {
    JSON(json!({ "message": "Internal Server Error" }))
}

fn set_log_level() {
    env::set_var("ROCKET_LOG", "critical");
}

use db::Pool;
use rocket::{self, Rocket, Request};
use rocket_contrib::{JSON, Value};

mod teams;
mod members;

pub fn app(pool: Pool) -> Rocket {
    rocket::ignite()
        .manage(pool)
        .mount("/teams", teams::routes())
        .mount("/members", members::routes())
        .catch(errors![not_found, server_error])
}

#[error(404)]
fn not_found(_req: &Request) -> JSON<Value> {
    JSON(json!({ "message": "Not Found" }))
}

#[error(500)]
fn server_error(_req: &Request) -> JSON<Value> {
    JSON(json!({ "message": "Internal Server Error" }))
}

--- 
+++ 
@@ -1,11 +1,13 @@
 use db::Pool;
 use rocket::{self, Rocket, Request};
 use rocket_contrib::{JSON, Value};
+use std::env;
 
 mod teams;
 mod members;
 
 pub fn app(pool: Pool) -> Rocket {
+    set_log_level();
     rocket::ignite()
         .manage(pool)
         .mount("/teams", teams::routes())
@@ -22,3 +24,7 @@
 fn server_error(_req: &Request) -> JSON<Value> {
     JSON(json!({ "message": "Internal Server Error" }))
 }
+
+fn set_log_level() {
+    env::set_var("ROCKET_LOG", "critical");
+}
feat: Configure Rocket to log minimally
