Skip to content

Commit

Permalink
chore: 修改 rebase 后的一些小问题
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoaer committed Jun 15, 2024
1 parent 107feac commit 39481e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
4 changes: 2 additions & 2 deletions crates/bili_sync/src/bilibili/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ mod tests {
use futures::{pin_mut, StreamExt};

use super::*;
use crate::core::utils::init_logging;
use crate::core::utils::init_logger;

#[test]
fn test_collection_info_parse() {
Expand Down Expand Up @@ -251,7 +251,7 @@ mod tests {
#[ignore = "only for manual test"]
#[tokio::test]
async fn test_get_info() {
init_logging().expect("初始化日志失败");
init_logger("None,bili_sync=info");
let client = BiliClient::new();
let testcases = vec![
(
Expand Down
13 changes: 0 additions & 13 deletions crates/bili_sync/src/core/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,6 @@ pub enum ModelWrapper<'a> {

pub struct NFOSerializer<'a>(pub ModelWrapper<'a>, pub NFOMode);

// 初始化日志
pub fn init_logging() -> Result<()> {
let default_log_level = std::env::var("RUST_LOG").unwrap_or("None,bili_sync=info".to_owned());
tracing_subscriber::fmt::Subscriber::builder()
.with_env_filter(tracing_subscriber::EnvFilter::builder().parse_lossy(default_log_level))
.with_timer(tracing_subscriber::fmt::time::ChronoLocal::new(
"%Y-%m-%d %H:%M:%S%.3f".to_owned(),
))
.finish()
.try_init()?;
Ok(())
}

/// 根据获得的收藏夹信息,插入或更新数据库中的收藏夹,并返回收藏夹对象
pub async fn handle_favorite_info(
info: &FavoriteListInfo,
Expand Down
7 changes: 2 additions & 5 deletions crates/bili_sync/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ mod database;
mod downloader;
mod error;

use core::utils::init_logging;

use core::utils::init_logging;

use std::time::Duration;

use config::ARGS;
use once_cell::sync::Lazy;
use tokio::time;

use crate::bilibili::BiliClient;
use crate::config::CONFIG;
use crate::core::command::process_collection, process_favorite_list;
use crate::core::command::{process_collection, process_favorite_list};
use crate::core::utils::init_logger;
use crate::database::{database_connection, migrate_database};

Expand Down

0 comments on commit 39481e6

Please sign in to comment.