core: reexport loggers

This commit is contained in:
anna 2022-12-05 23:03:26 +01:00
parent 38baa25561
commit 84589a1849
Signed by: fef
GPG key ID: EC22E476DC2D3D84
2 changed files with 7 additions and 2 deletions

View file

@ -4,6 +4,8 @@ use actix_web::{HttpResponse, ResponseError};
use serde::{Serialize, Serializer};
use std::{fmt, io};
pub use log::{debug, error, info, trace, warn};
pub type Id = i32;
pub type Result<T> = std::result::Result<T, Error>;

View file

@ -1,5 +1,4 @@
use actix_web::{get, web, App, HttpResponse, HttpServer, Responder};
use log::*;
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
use sqlx::postgres::PgPoolOptions;
use sqlx::{migrate, query, PgPool, Pool};
@ -7,8 +6,10 @@ mod conf;
mod core;
mod data;
mod model;
mod repo;
mod route;
mod state;
use crate::core::*;
use conf::Config;
use state::AppState;
@ -18,10 +19,12 @@ async fn main() -> std::io::Result<()> {
pretty_env_logger::init();
let config = Config::from_env();
info!("Establishing database connection");
let db_pool = init_db(&config).await.unwrap();
let bind_params = (config.bind_addr.clone(), config.bind_port.clone());
let state = state::new(config, db_pool);
info!("Starting application");
HttpServer::new(move || {
App::new()
.app_data(state.clone())