summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorThomas Linford <tlinford@users.noreply.github.com>2021-10-12 14:41:16 +0200
committerGitHub <noreply@github.com>2021-10-12 18:11:16 +0530
commit45af3e427985be811c6de6c79c3bf931b9ae2439 (patch)
tree7d5bf40545c94b5d941384aff93e94b279262a87 /zellij-utils/src
parent21901c6e79c0f0d190c42513be27b008752306ff (diff)
Preserve current umask (#777)
* preserve umask when starting server * make sure log files are created with explicit permissions
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/logging.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/zellij-utils/src/logging.rs b/zellij-utils/src/logging.rs
index 7e57eebda..6d2fe8c68 100644
--- a/zellij-utils/src/logging.rs
+++ b/zellij-utils/src/logging.rs
@@ -13,10 +13,14 @@ use log4rs::append::file::FileAppender;
use log4rs::config::{Appender, Config, Logger, Root};
use log4rs::encode::pattern::PatternEncoder;
-use crate::consts::{ZELLIJ_TMP_LOG_DIR, ZELLIJ_TMP_LOG_FILE};
+use crate::consts::{ZELLIJ_TMP_DIR, ZELLIJ_TMP_LOG_DIR, ZELLIJ_TMP_LOG_FILE};
use crate::shared::set_permissions;
pub fn configure_logger() {
+ atomic_create_dir(&*ZELLIJ_TMP_DIR).unwrap();
+ atomic_create_dir(&*ZELLIJ_TMP_LOG_DIR).unwrap();
+ atomic_create_file(&*ZELLIJ_TMP_LOG_DIR.join("zellij.log")).unwrap();
+
// {n} means platform dependent newline
// module is padded to exactly 25 bytes and thread is padded to be between 10 and 15 bytes.
let file_pattern = "{highlight({level:<6})} |{module:<25.25}| {date(%Y-%m-%d %H:%M:%S.%3f)} [{thread:<10.15}] [{file}:{line}]: {message} {n}";