feat: --no-stderr cli arg, closes #52
New cli argument which will remove stderr output from logs, defaults to false
This commit is contained in:
@@ -442,6 +442,7 @@ impl AppData {
|
||||
}
|
||||
|
||||
/// Find the longest port when it's transformed into a string, defaults are header lens (ip, private, public)
|
||||
/// TODO refactor this, and write comments as to whete the initial sizes come from
|
||||
pub fn get_longest_port(&self) -> (usize, usize, usize) {
|
||||
let mut longest_ip = 5;
|
||||
let mut longest_private = 10;
|
||||
|
||||
@@ -253,10 +253,11 @@ impl DockerData {
|
||||
init: Option<Arc<AtomicUsize>>,
|
||||
since: u64,
|
||||
spawns: Arc<Mutex<HashMap<SpawnId, JoinHandle<()>>>>,
|
||||
stderr: bool,
|
||||
) {
|
||||
let options = Some(LogsOptions::<String> {
|
||||
stdout: true,
|
||||
stderr: true,
|
||||
stderr,
|
||||
timestamps: true,
|
||||
since: i64::try_from(since).unwrap_or_default(),
|
||||
..Default::default()
|
||||
@@ -289,6 +290,7 @@ impl DockerData {
|
||||
init.map(Arc::clone),
|
||||
0,
|
||||
Arc::clone(&self.spawns),
|
||||
self.args.std_err,
|
||||
)),
|
||||
);
|
||||
}
|
||||
@@ -330,6 +332,7 @@ impl DockerData {
|
||||
None,
|
||||
last_updated,
|
||||
Arc::clone(&self.spawns),
|
||||
self.args.std_err,
|
||||
))
|
||||
});
|
||||
};
|
||||
@@ -348,7 +351,7 @@ impl DockerData {
|
||||
.set_error(AppError::DockerCommand(error), gui_state, Status::Error);
|
||||
}
|
||||
|
||||
/// Execute docker comamnds (start, stop etc) on it's own tokio thread
|
||||
/// Execute docker commands (start, stop etc) on it's own tokio thread
|
||||
async fn execute_command(&mut self, control: DockerCommand, id: ContainerId) {
|
||||
let (app_data, docker, gui_state) = (
|
||||
Arc::clone(&self.app_data),
|
||||
|
||||
@@ -164,6 +164,7 @@ mod tests {
|
||||
docker_interval: 1000,
|
||||
gui: true,
|
||||
host: None,
|
||||
std_err: false,
|
||||
in_container: false,
|
||||
save_dir: None,
|
||||
raw: false,
|
||||
|
||||
+9
-3
@@ -37,13 +37,17 @@ pub struct Args {
|
||||
#[clap(long, short = None)]
|
||||
pub host: Option<String>,
|
||||
|
||||
/// Force use of docker cli when execing into containers
|
||||
#[clap(long="use-cli", short = None)]
|
||||
pub use_cli: bool,
|
||||
/// Do not include stderr output in logs
|
||||
#[clap(long = "no-stderr")]
|
||||
pub no_std_err: bool,
|
||||
|
||||
/// Directory for saving exported logs, defaults to `$HOME`
|
||||
#[clap(long="save-dir", short = None)]
|
||||
pub save_dir: Option<String>,
|
||||
|
||||
/// Force use of docker cli when execing into containers
|
||||
#[clap(long="use-cli", short = None)]
|
||||
pub use_cli: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -58,6 +62,7 @@ pub struct CliArgs {
|
||||
pub raw: bool,
|
||||
pub show_self: bool,
|
||||
pub timestamp: bool,
|
||||
pub std_err: bool,
|
||||
pub use_cli: bool,
|
||||
}
|
||||
|
||||
@@ -92,6 +97,7 @@ impl CliArgs {
|
||||
in_container: Self::check_if_in_container(),
|
||||
save_dir: logs_dir,
|
||||
raw: args.raw,
|
||||
std_err: !args.no_std_err,
|
||||
show_self: !args.show_self,
|
||||
timestamp: !args.timestamp,
|
||||
}
|
||||
|
||||
@@ -220,6 +220,7 @@ impl Ui {
|
||||
}
|
||||
|
||||
/// Frequent data required by multiple framde drawing functions, can reduce mutex reads by placing it all in here
|
||||
/// TODO add more items to this, and split up into parts
|
||||
#[derive(Debug)]
|
||||
pub struct FrameData {
|
||||
columns: Columns,
|
||||
|
||||
Reference in New Issue
Block a user