Run server in docker container, added log file

This commit is contained in:
2020-11-09 02:00:14 -05:00
parent 5413fba309
commit e44aa9ddfc
6 changed files with 29 additions and 0 deletions

View File

@@ -68,9 +68,15 @@ async fn main() -> Result<()> {
dotenv().ok();
let env_log_filter =
env::var("RUST_LOG").unwrap_or_else(|_| "warp=info,bazaar_realm_api=info".to_owned());
let file_appender = tracing_appender::rolling::hourly(
env::var("LOG_DIR").unwrap_or_else(|_| ".".to_owned()),
"bazaarrealm.log",
);
let (non_blocking, _guard) = tracing_appender::non_blocking(file_appender);
tracing_subscriber::fmt()
.with_env_filter(env_log_filter)
.with_span_events(FmtSpan::CLOSE)
.with_writer(non_blocking)
.init();
let host = env::var("HOST").expect("`HOST` environment variable not defined");