修正不创建日志目录的问题

This commit is contained in:
2026-01-29 20:40:09 +08:00
parent 09a42be3cf
commit 4b56af8df7

View File

@@ -6,8 +6,8 @@ use chrono::Local;
use colored::{Color, Colorize};
use fern::Dispatch;
use log::Level;
use std::env;
use std::path::PathBuf;
use std::{env, fs};
#[tokio::main]
async fn main() {
@@ -35,7 +35,11 @@ pub fn get_current_dir() -> PathBuf {
}
pub fn get_log_path() -> PathBuf {
get_current_dir().join("logs")
let path = get_current_dir().join("logs");
if !path.exists() {
fs::create_dir_all(&path).expect("创建日志目录失败");
}
path
}
fn init_log() {