some logging
This commit is contained in:
@@ -22,9 +22,14 @@ type DbPool = r2d2::Pool<ConnectionManager<SqliteConnection>>;
|
||||
#[ntex::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
// std::env::set_var("RUST_BACKTRACE", "1");
|
||||
env_logger::init(); // You need this to actually see logs
|
||||
dotenv().ok();
|
||||
|
||||
// Enable request logging
|
||||
unsafe {
|
||||
std::env::set_var("RUST_LOG", "info");
|
||||
}
|
||||
env_logger::init(); // You need this to actually see logs
|
||||
|
||||
// set up database connection pool
|
||||
let connspec = std::env::var("DATABASE_URL").expect("DATABASE_URL");
|
||||
let manager = ConnectionManager::<SqliteConnection>::new(connspec);
|
||||
|
||||
@@ -17,6 +17,10 @@ pub enum AnyProvider {
|
||||
}
|
||||
impl Provider for AnyProvider {
|
||||
async fn get_videos(&self, cache: VideoCache, pool:DbPool, channel: String, sort: String, query: Option<String>, page: String, per_page: String, featured: String) -> Vec<VideoItem> {
|
||||
println!(
|
||||
"/api/videos: channel={:?}, sort={:?}, query={:?}, page={:?}, per_page={:?}, featured={:?}",
|
||||
channel, sort, query, page, per_page, featured
|
||||
);
|
||||
match self {
|
||||
AnyProvider::Perverzija(p) => p.get_videos(cache.clone(), pool.clone(), channel.clone(), sort.clone(), query.clone(), page.clone(), per_page.clone(), featured.clone()).await,
|
||||
AnyProvider::Hanime(p) => p.get_videos(cache, pool, channel, sort, query, page, per_page, featured).await,
|
||||
|
||||
Reference in New Issue
Block a user