Make SQLx logging debug level and add tower-http traces
Build and Publish Docker Container / build (push) Successful in 10m20s
Build and Publish Docker Container / build (push) Successful in 10m20s
This commit is contained in:
+9
-2
@@ -9,6 +9,8 @@ use clap::Parser;
|
||||
use migration::{Migrator, MigratorTrait};
|
||||
use sea_orm::{ConnectionTrait, DatabaseConnection};
|
||||
use std::net::SocketAddr;
|
||||
use tower_http::trace::TraceLayer;
|
||||
use tracing::log::LevelFilter;
|
||||
|
||||
#[derive(Debug, clap::Parser)]
|
||||
struct Config {
|
||||
@@ -36,7 +38,11 @@ async fn health_check(
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let config: Config = Config::parse();
|
||||
let connection = sea_orm::Database::connect(&config.database_url).await?;
|
||||
let connection = sea_orm::ConnectOptions::new(&config.database_url)
|
||||
.sqlx_logging_level(LevelFilter::Debug)
|
||||
.to_owned();
|
||||
|
||||
let connection = sea_orm::Database::connect(connection).await?;
|
||||
|
||||
if config.migrate {
|
||||
Migrator::up(&connection, None).await?;
|
||||
@@ -48,7 +54,8 @@ async fn main() -> anyhow::Result<()> {
|
||||
.route("/monzo-updated", post(monzo_updated))
|
||||
.route("/monzo-batch-export", post(monzo_batched_json))
|
||||
.route("/monzo-csv-ingestion", post(monzo_batched_csv))
|
||||
.layer(Extension(connection.clone()));
|
||||
.layer(Extension(connection.clone()))
|
||||
.layer(TraceLayer::new_for_http());
|
||||
|
||||
tracing::debug!("listening on {}", &config.addr);
|
||||
let listener = tokio::net::TcpListener::bind(&config.addr).await.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user