Rename logger module to status

This commit is contained in:
Marcin Kulik
2025-04-12 07:58:14 +02:00
parent 0facb54373
commit 4aced695d6
4 changed files with 16 additions and 16 deletions

View File

@@ -3,8 +3,8 @@ use anyhow::Result;
use crate::asciicast;
use crate::cli;
use crate::config::{self, Config};
use crate::logger;
use crate::player::{self, KeyBindings};
use crate::status;
use crate::tty;
use crate::util;
@@ -14,7 +14,7 @@ impl cli::Play {
let speed = self.speed.or(cmd_config.speed).unwrap_or(1.0);
let idle_time_limit = self.idle_time_limit.or(cmd_config.idle_time_limit);
logger::info!("Replaying session from {}", self.filename);
status::info!("Replaying session from {}", self.filename);
let path = util::get_local_path(&self.filename)?;
let keys = get_key_bindings(&cmd_config)?;
@@ -38,9 +38,9 @@ impl cli::Play {
};
if ended {
logger::info!("Playback ended");
status::info!("Playback ended");
} else {
logger::info!("Playback interrupted");
status::info!("Playback interrupted");
}
Ok(())

View File

@@ -25,11 +25,11 @@ use crate::encoder::{AsciicastEncoder, RawEncoder, TextEncoder};
use crate::file_writer::{FileWriterStarter, Metadata};
use crate::forwarder;
use crate::locale;
use crate::logger;
use crate::notifier::{self, Notifier, NullNotifier};
use crate::pty;
use crate::server;
use crate::session::{self, KeyBindings, SessionStarter};
use crate::status;
use crate::stream::Stream;
use crate::tty::{DevTty, FixedSizeTty, NullTty, Tty};
use crate::util;
@@ -96,25 +96,25 @@ impl cli::Session {
self.init_logging()?;
}
logger::info!("asciinema session started");
status::info!("asciinema session started");
if let Some(path) = path {
logger::info!("Recording to {}", path);
status::info!("Recording to {}", path);
}
if let Some(listener) = &listener {
logger::info!(
status::info!(
"Live streaming at http://{}",
listener.local_addr().unwrap()
);
}
if let Some(Relay { url: Some(url), .. }) = &relay {
logger::info!("Live streaming at {}", url);
status::info!("Live streaming at {}", url);
}
if command.is_none() {
logger::info!("Press <ctrl+d> or type 'exit' to end");
status::info!("Press <ctrl+d> or type 'exit' to end");
}
let stream = Stream::new();
@@ -174,7 +174,7 @@ impl cli::Session {
debug!("shutdown complete");
});
logger::info!("asciinema session ended");
status::info!("asciinema session ended");
Ok(())
}
@@ -345,7 +345,7 @@ impl cli::Session {
Ok(FixedSizeTty::new(dev_tty, cols, rows))
} else {
if !quiet {
logger::info!("TTY not available, recording in headless mode");
status::info!("TTY not available, recording in headless mode");
}
Ok(FixedSizeTty::new(NullTty::open()?, cols, rows))

View File

@@ -10,12 +10,12 @@ mod forwarder;
mod io;
mod leb128;
mod locale;
mod logger;
mod notifier;
mod player;
mod pty;
mod server;
mod session;
mod status;
mod stream;
mod tty;
mod util;
@@ -30,7 +30,7 @@ fn main() -> anyhow::Result<()> {
let config = Config::new(cli.server_url.clone())?;
if cli.quiet {
logger::disable();
status::disable();
}
let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();

View File

@@ -6,8 +6,8 @@ pub fn disable() {
}
macro_rules! info {
($fmt:expr) => (crate::logger::println(format!($fmt)));
($fmt:expr, $($arg:tt)*) => (crate::logger::println(format!($fmt, $($arg)*)));
($fmt:expr) => (crate::status::println(format!($fmt)));
($fmt:expr, $($arg:tt)*) => (crate::status::println(format!($fmt, $($arg)*)));
}
pub fn println(message: String) {