rename log_path.rs to log.rs

This commit is contained in:
gaofei 2025-01-15 09:39:31 +08:00
parent 19fc250c3a
commit 9c9483f070
7 changed files with 13 additions and 13 deletions

View File

@ -2,12 +2,12 @@
name = "pmr"
version = "0.0.1"
edition = "2021"
authors = ["Your Name <you@example.com>"]
authors = ["GaoGaoWhipser <gaogaowhisper@qq.com>"]
description = "A process manager in Rust"
license = "MIT"
[dependencies]
clap = { version = "4.4.11", features = ["derive"] }
clap = { version = "4.5", features = ["derive"] }
sysinfo = "0.29.11"
tabled = "0.14.0"
serde = { version = "1.0.193", features = ["derive"] }
@ -15,5 +15,5 @@ dirs = "5.0.1"
serde_json = "1.0.108"
crossterm = "0.28.1"
once_cell = "1.18.0"
ctrlc = "3.4.1"
ctrlc = "3.4.5"
windows-sys = "0.36.1"

View File

@ -9,5 +9,5 @@ pmr list/ls
pmr stop [id;name]
pmr stop [id;name]
pmr restart [id;name]
pmr delete/rm [id:name]
pmr delete/rm [id;name]
```

View File

@ -1,5 +1,5 @@
use super::super::config::dump::DumpConfig;
use super::super::config::log_path;
use super::super::config::log;
use ctrlc;
use std::fs::File;
use std::io::{self, BufRead, BufReader, Seek, SeekFrom};
@ -38,7 +38,7 @@ pub fn tail_log(target: String) -> io::Result<()> {
};
// 获取日志文件路径
let log_path = match log_path::get_log_path(pmr_id) {
let log_path = match log::get_log_path(pmr_id) {
Ok(path) => path,
Err(e) => {
eprintln!("无法获取日志文件路径: {}", e);

View File

@ -1,6 +1,6 @@
use super::super::base::process::PmrProcessInfo;
use super::super::config::dump::DumpConfig;
use super::super::config::log_path;
use super::super::config::log;
use super::list::list_processes;
use super::start::start_process;
use super::stop::stop_process;
@ -48,7 +48,7 @@ fn restart_existing_process(process: &PmrProcessInfo) -> io::Result<()> {
stop_process(&process.pmr_id.to_string(), false);
// 获取日志文件路径
let log_path = log_path::get_log_path(process.pmr_id)?;
let log_path = log::get_log_path(process.pmr_id)?;
// 打开日志文件(追加模式)
let log_file = OpenOptions::new()

View File

@ -1,6 +1,6 @@
use super::super::base::process::PmrProcessInfo;
use super::super::config::dump::DumpConfig;
use super::super::config::log_path;
use super::super::config::log;
use super::list::list_processes;
use super::stop::stop_process;
use serde::{Deserialize, Serialize};
@ -84,7 +84,7 @@ pub fn start_process(
)?;
// 获取日志文件路径
let log_path = log_path::get_log_path(new_id)?;
let log_path = log::get_log_path(new_id)?;
// 打开日志文件(追加模式)
let log_file = OpenOptions::new()
@ -134,7 +134,7 @@ pub fn start_process(
)?;
// 获取日志文件路径
let log_path = log_path::get_log_path(new_id)?;
let log_path = log::get_log_path(new_id)?;
// 打开日志文件(追加模式)
let log_file = OpenOptions::new()
@ -187,7 +187,7 @@ fn start_existing_process(process: &PmrProcessInfo) -> io::Result<()> {
stop_process(&process.pmr_id.to_string(), false);
// 获取日志文件路径
let log_path = log_path::get_log_path(process.pmr_id)?;
let log_path = log::get_log_path(process.pmr_id)?;
// 打开日志文件(追加模式)
let log_file = OpenOptions::new()

View File

@ -1,2 +1,2 @@
pub mod dump;
pub mod log_path;
pub mod log;