Skip to content

Commit

Permalink
Remove json logging
Browse files Browse the repository at this point in the history
  • Loading branch information
aligator committed Sep 12, 2023
1 parent fb53936 commit f7f044c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 155 deletions.
141 changes: 0 additions & 141 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ schemars = { version = "0.8.13" }
serde = "1.0.181"
time = { version = "0.3.23", features = ["serde", "formatting", "macros"] }
log = { version = "0.4.19", features = ['std'] }
structured-logger = "1.0.3"
anyhow = "1.0"
7 changes: 1 addition & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use dotenvy::dotenv;

pub struct Config {
pub database_url: String,
pub json_logger: bool,
}

fn var(key: &str) -> Result<String> {
Expand All @@ -16,10 +15,6 @@ impl Config {
pub fn from_env() -> Result<Self> {
dotenv().ok();
let database_url = var("DATABASE_URL")?;
let json_logger = var("JSON_LOGGER").unwrap_or("0".to_string()) == "1";
Ok(Config {
database_url,
json_logger,
})
Ok(Config { database_url })
}
}
7 changes: 0 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use rocket::{Orbit, Rocket};
use rocket_okapi::rapidoc::{make_rapidoc, GeneralConfig, HideShowConfig, RapiDocConfig};
use rocket_okapi::settings::UrlObject;
use rocket_okapi::swagger_ui::{make_swagger_ui, SwaggerUIConfig};
use serde::Serialize;
use structured_logger::Builder;

use crate::config::Config;

Expand Down Expand Up @@ -45,11 +43,6 @@ impl Fairing for StartupFairing {
async fn main() -> Result<(), Box<dyn Error>> {
let cfg = Config::from_env()?;

if cfg.json_logger {
// Initialize the logger.
Builder::new().init();
}

let db = db::init_pool(&cfg);

// Setup the services.
Expand Down

0 comments on commit f7f044c

Please sign in to comment.