Replace dbg macros with tracing events

This commit is contained in:
2021-07-11 19:45:26 -04:00
parent 22757bc475
commit 792e78391c
13 changed files with 199 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use tracing::instrument;
#[derive(Debug, Serialize, Deserialize)]
pub struct Cell {
@@ -13,6 +14,7 @@ pub struct Cell {
pub created_at: NaiveDateTime,
}
#[instrument(level = "debug", skip(pool))]
pub async fn insert_cell(
pool: &sqlx::Pool<sqlx::Postgres>,
form_id: i32,

View File

@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use tracing::instrument;
#[derive(Debug, Serialize, Deserialize)]
pub struct File {
@@ -17,6 +18,7 @@ pub struct File {
pub created_at: NaiveDateTime,
}
#[instrument(level = "debug", skip(pool))]
pub async fn insert_file(
pool: &sqlx::Pool<sqlx::Postgres>,
name: &str,

View File

@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use tracing::instrument;
#[derive(Debug, Serialize, Deserialize)]
pub struct Game {
@@ -11,6 +12,7 @@ pub struct Game {
pub created_at: NaiveDateTime,
}
#[instrument(level = "debug", skip(pool))]
pub async fn insert_game(
pool: &sqlx::Pool<sqlx::Postgres>,
name: &str,

View File

@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use tracing::instrument;
#[derive(Debug, Serialize, Deserialize)]
pub struct Mod {
@@ -15,6 +16,7 @@ pub struct Mod {
pub created_at: NaiveDateTime,
}
#[instrument(level = "debug", skip(pool))]
pub async fn get_mod_by_nexus_mod_id(
pool: &sqlx::Pool<sqlx::Postgres>,
nexus_mod_id: i32,
@@ -29,6 +31,7 @@ pub async fn get_mod_by_nexus_mod_id(
.context("Failed to get mod")
}
#[instrument(level = "debug", skip(pool))]
pub async fn insert_mod(
pool: &sqlx::Pool<sqlx::Postgres>,
name: &str,

View File

@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use tracing::instrument;
#[derive(Debug, Serialize, Deserialize)]
pub struct Plugin {
@@ -16,6 +17,7 @@ pub struct Plugin {
pub created_at: NaiveDateTime,
}
#[instrument(level = "debug", skip(pool))]
pub async fn insert_plugin(
pool: &sqlx::Pool<sqlx::Postgres>,
name: &str,
@@ -46,4 +48,4 @@ pub async fn insert_plugin(
.fetch_one(pool)
.await
.context("Failed to insert plugin")
}
}

View File

@@ -1,7 +1,7 @@
use anyhow::{Context, Result};
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use tracing::instrument;
#[derive(Debug, Serialize, Deserialize)]
pub struct PluginCell {
pub id: i32,
@@ -12,6 +12,7 @@ pub struct PluginCell {
pub created_at: NaiveDateTime,
}
#[instrument(level = "debug", skip(pool))]
pub async fn insert_plugin_cell(
pool: &sqlx::Pool<sqlx::Postgres>,
plugin_id: i32,
@@ -33,4 +34,4 @@ pub async fn insert_plugin_cell(
.fetch_one(pool)
.await
.context("Failed to insert cell")
}
}