feat(asb + cli): Redact logs + unify tracing infrastructure (#1733) (#55)

* feat(asb + cli): Redact logs + unify tracing infrastructure (#1733)

Applies the changes from https://github.com/comit-network/xmr-btc-swap/pull/1733 to this fork

---------

Co-authored-by: Einliterflasche <81313171+Einliterflasche@users.noreply.github.com>
This commit is contained in:
binarybaron 2024-09-01 18:13:43 +02:00 committed by GitHub
parent 1fe6391b7b
commit 792fbbf746
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 1780 additions and 1396 deletions

View file

@ -4,8 +4,8 @@ use crate::protocol::{Database, State};
use anyhow::{anyhow, Context, Result};
use async_trait::async_trait;
use libp2p::{Multiaddr, PeerId};
use sqlx::sqlite::Sqlite;
use sqlx::{Pool, SqlitePool};
use sqlx::sqlite::{Sqlite, SqliteConnectOptions};
use sqlx::{ConnectOptions, Pool, SqlitePool};
use std::path::Path;
use std::str::FromStr;
use time::OffsetDateTime;
@ -21,9 +21,16 @@ impl SqliteDatabase {
Self: std::marker::Sized,
{
let path_str = format!("sqlite:{}", path.as_ref().display());
let pool = SqlitePool::connect(&path_str).await?;
let mut options = SqliteConnectOptions::from_str(&path_str)?;
options.disable_statement_logging();
let pool = SqlitePool::connect_with(options).await?;
let mut sqlite = Self { pool };
sqlite.run_migrations().await?;
Ok(sqlite)
}