diff --git a/src/config.rs b/src/config.rs
index fd153678..d2aaf033 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -247,6 +247,8 @@ make_config! {
/// Reload templates (Dev) |> When this is set to true, the templates get reloaded with every request. ONLY use this during development, as it can slow down the server
reload_templates: bool, true, def, false;
+ /// Log routes at launch (Dev)
+ log_mounts: bool, true, def, false;
/// Enable extended logging
extended_logging: bool, false, def, true;
/// Log file path
diff --git a/src/main.rs b/src/main.rs
index dda1752c..ff7f8b97 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -39,18 +39,37 @@ mod util;
pub use config::CONFIG;
-fn init_rocket() -> Rocket {
- rocket::ignite()
+fn launch_rocket() {
+ // Create Rocket object, this stores current log level and sets it's own
+ let rocket = rocket::ignite();
+
+ // If we aren't logging the mounts, we force the logging level down
+ if !CONFIG.log_mounts() {
+ log::set_max_level(log::LevelFilter::Warn);
+ }
+
+ let rocket = rocket
.mount("/", api::web_routes())
.mount("/api", api::core_routes())
.mount("/admin", api::admin_routes())
.mount("/identity", api::identity_routes())
.mount("/icons", api::icons_routes())
- .mount("/notifications", api::notifications_routes())
+ .mount("/notifications", api::notifications_routes());
+
+ // Force the level up for the fairings, managed state and lauch
+ if !CONFIG.log_mounts() {
+ log::set_max_level(log::LevelFilter::max());
+ }
+
+ let rocket = rocket
.manage(db::init_pool())
.manage(api::start_notification_server())
.attach(util::AppHeaders())
- .attach(AdHoc::on_launch("Launch Info", launch_info))
+ .attach(AdHoc::on_launch("Launch Info", launch_info));
+
+ // Launch and print error if there is one
+ // The launch will restore the original logging level
+ error!("Launch error {:#?}", rocket.launch());
}
// Embed the migrations from the migrations folder into the application
@@ -79,7 +98,7 @@ fn main() {
check_web_vault();
migrations::run_migrations();
- init_rocket().launch();
+ launch_rocket();
}
fn init_logging() -> Result<(), fern::InitError> {
diff --git a/src/static/templates/admin/page.hbs b/src/static/templates/admin/page.hbs
index 6b74e09c..fc948884 100644
--- a/src/static/templates/admin/page.hbs
+++ b/src/static/templates/admin/page.hbs
@@ -89,9 +89,7 @@
- {{#if default}}
- {{/if}}
{{/case}}