feat(main): adding the tracing init
This commit is contained in:
parent
ea8da998b1
commit
c8344b4d9d
1 changed files with 9 additions and 5 deletions
14
src/main.rs
14
src/main.rs
|
|
@ -10,12 +10,16 @@ use serenity::all::*;
|
||||||
use sqlx::postgres::PgPoolOptions;
|
use sqlx::postgres::PgPoolOptions;
|
||||||
use sqlx::{Pool, Postgres, migrate};
|
use sqlx::{Pool, Postgres, migrate};
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use tracing::{
|
||||||
|
info,
|
||||||
|
error
|
||||||
|
};
|
||||||
|
|
||||||
use self::config::emoji::EmojiConfig;
|
use self::config::emoji::EmojiConfig;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
println!("\n");
|
tracing_subscriber::fmt::init();
|
||||||
dotenvy::dotenv().ok();
|
dotenvy::dotenv().ok();
|
||||||
|
|
||||||
let token: String =
|
let token: String =
|
||||||
|
|
@ -29,16 +33,16 @@ async fn main() {
|
||||||
.connect(&database_url)
|
.connect(&database_url)
|
||||||
.await
|
.await
|
||||||
.expect("❌ | Failed to connect to PostgreSQL");
|
.expect("❌ | Failed to connect to PostgreSQL");
|
||||||
println!("✅ | Connected to PostgreSQL");
|
info!("✅ | Connected to PostgreSQL");
|
||||||
|
|
||||||
migrate!("./migrations")
|
migrate!("./migrations")
|
||||||
.run(&db)
|
.run(&db)
|
||||||
.await
|
.await
|
||||||
.expect("❌ | Failed to run migrations");
|
.expect("❌ | Failed to run migrations");
|
||||||
println!("✅ | Migrations applied");
|
info!("✅ | Migrations applied");
|
||||||
|
|
||||||
let emojis: EmojiConfig = EmojiConfig::load().expect("❌ | Failed to load emojis.toml");
|
let emojis: EmojiConfig = EmojiConfig::load().expect("❌ | Failed to load emojis.toml");
|
||||||
println!("✅ | Emojis loaded\n");
|
info!("✅ | Emojis loaded\n");
|
||||||
|
|
||||||
let intents: GatewayIntents = GatewayIntents::AUTO_MODERATION_CONFIGURATION
|
let intents: GatewayIntents = GatewayIntents::AUTO_MODERATION_CONFIGURATION
|
||||||
| GatewayIntents::AUTO_MODERATION_EXECUTION
|
| GatewayIntents::AUTO_MODERATION_EXECUTION
|
||||||
|
|
@ -67,6 +71,6 @@ async fn main() {
|
||||||
.expect("❌ | Error when loading bot");
|
.expect("❌ | Error when loading bot");
|
||||||
|
|
||||||
if let Err(why) = client.start().await {
|
if let Err(why) = client.start().await {
|
||||||
eprintln!("❌ | Client error: {why:?}")
|
error!("❌ | Client error: {why:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue