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:
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
+ help_box closure fn, [2860426d57a4458fcee49a2fd20e8e7bb9e71fb5]
|
+ help_box closure fn, [2860426d57a4458fcee49a2fd20e8e7bb9e71fb5]
|
||||||
+ use check_sub for sleep calculations, [fe3696e5576739d8b033d9e748b5ea696c4b4e4f]
|
+ use check_sub for sleep calculations, [fe3696e5576739d8b033d9e748b5ea696c4b4e4f]
|
||||||
+ rename scheduler to heartbeat, [68a6551ed038a36330b2f098112829465a1c3c7a]
|
+ rename scheduler to heartbeat, [68a6551ed038a36330b2f098112829465a1c3c7a]
|
||||||
+ remove uneccessary is_running load, [76ccf7c00691f815c3ab0bede838c99252ba84f0]
|
+ remove unnecessary is_running load, [76ccf7c00691f815c3ab0bede838c99252ba84f0]
|
||||||
+ execute_command(), [2a834d6c2fa4a15124d24ddbd12f667829e148ad]
|
+ execute_command(), [2a834d6c2fa4a15124d24ddbd12f667829e148ad]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ Available command line arguments
|
|||||||
|```-s```| If running via Docker, will display the oxker container.|
|
|```-s```| If running via Docker, will display the oxker container.|
|
||||||
|```-g```| No TUI, essentially a debugging mode with limited functionality, for now.|
|
|```-g```| No TUI, essentially a debugging mode with limited functionality, for now.|
|
||||||
|```--host [string]```| Connect to Docker with a custom hostname. Defaults to `/var/run/docker.sock`. Will use `$DOCKER_HOST` environment variable if set.|
|
|```--host [string]```| Connect to Docker with a custom hostname. Defaults to `/var/run/docker.sock`. Will use `$DOCKER_HOST` environment variable if set.|
|
||||||
|
|```--no-stderr```| Do not include stderr output in logs.|
|
||||||
|```--save-dir [string]```| Save exported logs into a custom directory. Defaults to `$HOME`.|
|
|```--save-dir [string]```| Save exported logs into a custom directory. Defaults to `$HOME`.|
|
||||||
|```--use-cli```| Use the Docker application when exec-ing into a container, instead of the Docker API.|
|
|```--use-cli```| Use the Docker application when exec-ing into a container, instead of the Docker API.|
|
||||||
|
|
||||||
|
|||||||
@@ -442,6 +442,7 @@ impl AppData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Find the longest port when it's transformed into a string, defaults are header lens (ip, private, public)
|
/// 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) {
|
pub fn get_longest_port(&self) -> (usize, usize, usize) {
|
||||||
let mut longest_ip = 5;
|
let mut longest_ip = 5;
|
||||||
let mut longest_private = 10;
|
let mut longest_private = 10;
|
||||||
|
|||||||
@@ -253,10 +253,11 @@ impl DockerData {
|
|||||||
init: Option<Arc<AtomicUsize>>,
|
init: Option<Arc<AtomicUsize>>,
|
||||||
since: u64,
|
since: u64,
|
||||||
spawns: Arc<Mutex<HashMap<SpawnId, JoinHandle<()>>>>,
|
spawns: Arc<Mutex<HashMap<SpawnId, JoinHandle<()>>>>,
|
||||||
|
stderr: bool,
|
||||||
) {
|
) {
|
||||||
let options = Some(LogsOptions::<String> {
|
let options = Some(LogsOptions::<String> {
|
||||||
stdout: true,
|
stdout: true,
|
||||||
stderr: true,
|
stderr,
|
||||||
timestamps: true,
|
timestamps: true,
|
||||||
since: i64::try_from(since).unwrap_or_default(),
|
since: i64::try_from(since).unwrap_or_default(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@@ -289,6 +290,7 @@ impl DockerData {
|
|||||||
init.map(Arc::clone),
|
init.map(Arc::clone),
|
||||||
0,
|
0,
|
||||||
Arc::clone(&self.spawns),
|
Arc::clone(&self.spawns),
|
||||||
|
self.args.std_err,
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -330,6 +332,7 @@ impl DockerData {
|
|||||||
None,
|
None,
|
||||||
last_updated,
|
last_updated,
|
||||||
Arc::clone(&self.spawns),
|
Arc::clone(&self.spawns),
|
||||||
|
self.args.std_err,
|
||||||
))
|
))
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -348,7 +351,7 @@ impl DockerData {
|
|||||||
.set_error(AppError::DockerCommand(error), gui_state, Status::Error);
|
.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) {
|
async fn execute_command(&mut self, control: DockerCommand, id: ContainerId) {
|
||||||
let (app_data, docker, gui_state) = (
|
let (app_data, docker, gui_state) = (
|
||||||
Arc::clone(&self.app_data),
|
Arc::clone(&self.app_data),
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ mod tests {
|
|||||||
docker_interval: 1000,
|
docker_interval: 1000,
|
||||||
gui: true,
|
gui: true,
|
||||||
host: None,
|
host: None,
|
||||||
|
std_err: false,
|
||||||
in_container: false,
|
in_container: false,
|
||||||
save_dir: None,
|
save_dir: None,
|
||||||
raw: false,
|
raw: false,
|
||||||
|
|||||||
+9
-3
@@ -37,13 +37,17 @@ pub struct Args {
|
|||||||
#[clap(long, short = None)]
|
#[clap(long, short = None)]
|
||||||
pub host: Option<String>,
|
pub host: Option<String>,
|
||||||
|
|
||||||
/// Force use of docker cli when execing into containers
|
/// Do not include stderr output in logs
|
||||||
#[clap(long="use-cli", short = None)]
|
#[clap(long = "no-stderr")]
|
||||||
pub use_cli: bool,
|
pub no_std_err: bool,
|
||||||
|
|
||||||
/// Directory for saving exported logs, defaults to `$HOME`
|
/// Directory for saving exported logs, defaults to `$HOME`
|
||||||
#[clap(long="save-dir", short = None)]
|
#[clap(long="save-dir", short = None)]
|
||||||
pub save_dir: Option<String>,
|
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)]
|
#[derive(Debug, Clone)]
|
||||||
@@ -58,6 +62,7 @@ pub struct CliArgs {
|
|||||||
pub raw: bool,
|
pub raw: bool,
|
||||||
pub show_self: bool,
|
pub show_self: bool,
|
||||||
pub timestamp: bool,
|
pub timestamp: bool,
|
||||||
|
pub std_err: bool,
|
||||||
pub use_cli: bool,
|
pub use_cli: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +97,7 @@ impl CliArgs {
|
|||||||
in_container: Self::check_if_in_container(),
|
in_container: Self::check_if_in_container(),
|
||||||
save_dir: logs_dir,
|
save_dir: logs_dir,
|
||||||
raw: args.raw,
|
raw: args.raw,
|
||||||
|
std_err: !args.no_std_err,
|
||||||
show_self: !args.show_self,
|
show_self: !args.show_self,
|
||||||
timestamp: !args.timestamp,
|
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
|
/// 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)]
|
#[derive(Debug)]
|
||||||
pub struct FrameData {
|
pub struct FrameData {
|
||||||
columns: Columns,
|
columns: Columns,
|
||||||
|
|||||||
Reference in New Issue
Block a user