summaryrefslogtreecommitdiffstats
path: root/src/log.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-03-09 21:16:30 +0100
committerqkzk <qu3nt1n@gmail.com>2023-03-09 21:16:30 +0100
commit62e55a1e7f0b015fa30a01dab77af0e031710e76 (patch)
tree841b700bcd727a962b9f7171f3593f9768b73a0a /src/log.rs
parent1dbc6963eeb23f769ddd43299a95880cdaf26049 (diff)
simplify log reading since their size is limited anyway
Diffstat (limited to 'src/log.rs')
-rw-r--r--src/log.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/log.rs b/src/log.rs
index 23166c5..adfebbe 100644
--- a/src/log.rs
+++ b/src/log.rs
@@ -2,7 +2,7 @@ use log4rs;
use crate::constant_strings_paths::{ACTION_LOG_PATH, LOG_CONFIG_PATH};
use crate::fm_error::FmResult;
-use crate::utils::extract_last_lines_poorly;
+use crate::utils::extract_lines;
pub fn set_loggers() -> FmResult<()> {
log4rs::init_file(
@@ -13,8 +13,8 @@ pub fn set_loggers() -> FmResult<()> {
}
/// Returns the last line of the log file.
-pub fn read_log(line_nr: usize) -> FmResult<Vec<String>> {
+pub fn read_log() -> FmResult<Vec<String>> {
let log_path = shellexpand::tilde(ACTION_LOG_PATH).to_string();
let content = std::fs::read_to_string(log_path)?;
- Ok(extract_last_lines_poorly(content, line_nr))
+ Ok(extract_lines(content))
}