diff options
| author | Thomas Linford <tlinford@users.noreply.github.com> | 2021-10-12 14:41:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-12 18:11:16 +0530 |
| commit | 45af3e427985be811c6de6c79c3bf931b9ae2439 (patch) | |
| tree | 7d5bf40545c94b5d941384aff93e94b279262a87 /zellij-utils/src/logging.rs | |
| parent | docs(changelog): kill sessions commands (diff) | |
| download | sl0ppij-45af3e427985be811c6de6c79c3bf931b9ae2439.tar.gz sl0ppij-45af3e427985be811c6de6c79c3bf931b9ae2439.tar.xz sl0ppij-45af3e427985be811c6de6c79c3bf931b9ae2439.zip | |
Preserve current umask (#777)
* preserve umask when starting server
* make sure log files are created with explicit permissions
Diffstat (limited to '')
| -rw-r--r-- | zellij-utils/src/logging.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/zellij-utils/src/logging.rs b/zellij-utils/src/logging.rs index 7e57eebd..6d2fe8c6 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}"; |
