Minor fixes

This commit is contained in:
Paweł Palenica 2021-07-17 23:50:24 -07:00
parent 3326f521ef
commit 27634423d9
5 changed files with 9 additions and 18 deletions

View File

@ -4,7 +4,6 @@ mod sessions;
mod tests;
use crate::install::populate_data_dir;
use log::info;
use sessions::{assert_session, assert_session_ne, get_active_session, list_sessions};
use std::convert::TryFrom;
use std::process;
@ -21,7 +20,6 @@ use zellij_utils::{
pub fn main() {
configure_logger();
info!("Starting Zellij!");
let opts = CliArgs::from_args();
if let Some(Command::Sessions(Sessions::ListSessions)) = opts.command {

View File

@ -89,6 +89,7 @@ pub fn start_client(
info: ClientInfo,
layout: Option<Layout>,
) {
info!("Starting Zellij client!");
let clear_client_terminal_attributes = "\u{1b}[?1l\u{1b}=\u{1b}[r\u{1b}12l\u{1b}[?1000l\u{1b}[?1002l\u{1b}[?1003l\u{1b}[?1005l\u{1b}[?1006l\u{1b}[?12l";
let take_snapshot = "\u{1b}[?1049h";
let bracketed_paste = "\u{1b}[?2004h";

View File

@ -116,7 +116,7 @@ pub(crate) enum SessionState {
}
pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
info!("starts server");
info!("Starting Zellij server!");
daemonize::Daemonize::new()
.working_directory(std::env::current_dir().unwrap())
.umask(0o077)

View File

@ -3,7 +3,7 @@ use std::{
io::{Read, Seek, Write},
};
use log::{debug, error, info};
use log::{debug, error};
use wasmer_wasi::{WasiFile, WasiFsError};
use zellij_utils::serde;
@ -22,13 +22,6 @@ pub struct LoggingPipe {
impl LoggingPipe {
pub fn new(plugin_name: &str, plugin_id: u32) -> LoggingPipe {
info!(
"|{:<25.25}| {} [{:<10.15}] Creating decorating pipe for plugin: {}!",
plugin_name,
Local::now().format("%Y-%m-%d %H:%M:%S.%3f"),
format!("id: {}", plugin_id),
plugin_name
);
LoggingPipe {
buffer: VecDeque::new(),
plugin_name: String::from(plugin_name),
@ -49,11 +42,12 @@ impl LoggingPipe {
impl Read for LoggingPipe {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
// NOTE: should we do this? I think if anyone were to chain LoggingPipe and read from it,
// they would see very weird behavior because we drain self.buffer in `flush`. Also, logs would be screwed up.
// Consider removing this code.
let amt = std::cmp::min(buf.len(), self.buffer.len());
for (i, byte) in self.buffer.drain(..amt).enumerate() {
buf[i] = byte;
}
Ok(amt)
let data: Vec<_> = self.buffer.drain(..amt).collect();
buf.as_mut().write(&data)
}
}

View File

@ -7,7 +7,7 @@ use std::{
path::{Path, PathBuf},
};
use log::{info, LevelFilter};
use log::LevelFilter;
use log4rs::append::file::FileAppender;
use log4rs::config::{Appender, Config, Logger, Root};
@ -59,8 +59,6 @@ pub fn configure_logger() {
.unwrap();
let _ = log4rs::init_config(config).unwrap();
info!("Zellij logger initialized");
}
pub fn atomic_create_file(file_name: &Path) -> io::Result<()> {