diff --git a/bubblewrap-pilot/src/main.rs b/bubblewrap-pilot/src/main.rs index fa7822c..eb3710b 100644 --- a/bubblewrap-pilot/src/main.rs +++ b/bubblewrap-pilot/src/main.rs @@ -72,7 +72,7 @@ fn run() -> Result { fn setup_logger() { let env = Env::default() .filter_or("FLAKE_LOG_LEVEL", "debug") - .write_style_or("FLAKE_LOG_STYLE", "always"); + .write_style_or("FLAKE_LOG_STYLE", "never"); env_logger::init_from_env(env); } diff --git a/doc/user_guide/troubleshooting.rst b/doc/user_guide/troubleshooting.rst index 72b4556..fb6c2b5 100644 --- a/doc/user_guide/troubleshooting.rst +++ b/doc/user_guide/troubleshooting.rst @@ -28,15 +28,18 @@ call also shows the complete list of mounts the application is given, which is usually what a missing file inside the sandbox comes down to. -The styling of the log output is controlled by the following -environment variable: +The log output is written without color by default. Colors are +enabled with the following environment variable: .. code-block:: bash FLAKE_LOG_STYLE=always myapp -Accepted values are ``always`` (default), ``never`` and ``auto``. -An unrecognized value falls back to ``auto``. +Accepted values are ``never`` (default), ``always`` and ``auto``. +An unrecognized value falls back to ``auto``. The variable applies +to the pilots and to flake-ctl. flake-pilot-helper does not see the +environment of its caller and always writes its messages without +color. Known Issues ============ diff --git a/firecracker-pilot/guestvm-tools/sci/src/main.rs b/firecracker-pilot/guestvm-tools/sci/src/main.rs index b6c5579..f8d5522 100644 --- a/firecracker-pilot/guestvm-tools/sci/src/main.rs +++ b/firecracker-pilot/guestvm-tools/sci/src/main.rs @@ -1878,7 +1878,7 @@ fn setup_logger() { !*/ let env = Env::default() .filter_or("FLAKE_LOG_LEVEL", "trace") - .write_style_or("FLAKE_LOG_STYLE", "always"); + .write_style_or("FLAKE_LOG_STYLE", "never"); env_logger::init_from_env(env); } diff --git a/firecracker-pilot/src/firecracker.rs b/firecracker-pilot/src/firecracker.rs index 3c77a60..bae1800 100644 --- a/firecracker-pilot/src/firecracker.rs +++ b/firecracker-pilot/src/firecracker.rs @@ -34,7 +34,7 @@ use flakes::network::{ read_network_config, get_jump_rules, get_masquerade_rule, FirewallRule, NetworkConfig }; -use spinoff::{Spinner, spinners, Color}; +use spinoff::{Spinner, spinners}; use ubyte::ByteUnit; use std::path::Path; use std::process::{Stdio, id}; @@ -252,7 +252,7 @@ pub fn create(program_name: &String) -> Result<(String, String), FlakeError> { spinner = Some( Spinner::new_with_stream( spinners::Line, "Launching flake...", - Color::Yellow, spinoff::Streams::Stderr + None, spinoff::Streams::Stderr ) ); } @@ -260,13 +260,13 @@ pub fn create(program_name: &String) -> Result<(String, String), FlakeError> { match run_creation(&vm_id_file_path, program_name, engine_section) { Ok(result) => { if let Some(spinner) = spinner { - spinner.success("Launching flake"); + spinner.stop_and_persist("✓", "Launching flake"); } Ok(result) }, Err(error) => { if let Some(spinner) = spinner { - spinner.fail("Flake launch has failed"); + spinner.stop_and_persist("✗", "Flake launch has failed"); } Err(error) }, diff --git a/firecracker-pilot/src/main.rs b/firecracker-pilot/src/main.rs index 1a9594c..f2d0c55 100644 --- a/firecracker-pilot/src/main.rs +++ b/firecracker-pilot/src/main.rs @@ -69,7 +69,7 @@ fn run() -> Result<(), FlakeError> { fn setup_logger() { let env = Env::default() .filter_or("FLAKE_LOG_LEVEL", "debug") - .write_style_or("FLAKE_LOG_STYLE", "always"); + .write_style_or("FLAKE_LOG_STYLE", "never"); env_logger::init_from_env(env); } diff --git a/flake-ctl/src/fetch.rs b/flake-ctl/src/fetch.rs index 7e1908c..f000492 100644 --- a/flake-ctl/src/fetch.rs +++ b/flake-ctl/src/fetch.rs @@ -43,9 +43,9 @@ pub async fn fetch_file( &format!( "{}\n{} [{}] [{}] {}/{} ({}, {})", "{msg}", - "{spinner:.green}", + "{spinner}", "{elapsed_precise}", - "{wide_bar:.cyan/blue}", + "{wide_bar}", "{bytes}", "{total_bytes}", "{bytes_per_sec}", diff --git a/flake-ctl/src/main.rs b/flake-ctl/src/main.rs index 99c3b32..f61a556 100644 --- a/flake-ctl/src/main.rs +++ b/flake-ctl/src/main.rs @@ -515,7 +515,7 @@ fn init_flakes_dir(usermode: bool) -> Result<(), Box> { fn setup_logger() { let env = Env::default() .filter_or("FLAKE_LOG_LEVEL", "info") - .write_style_or("FLAKE_LOG_STYLE", "always"); + .write_style_or("FLAKE_LOG_STYLE", "never"); env_logger::init_from_env(env); } diff --git a/flake-pilot-helper/src/main.rs b/flake-pilot-helper/src/main.rs index 477f726..f6c21bf 100644 --- a/flake-pilot-helper/src/main.rs +++ b/flake-pilot-helper/src/main.rs @@ -139,10 +139,10 @@ fn setup_logger(debug: bool) { The log messages are only shown in debug mode, see PILOT_DEBUG. Errors are always shown, they tell the caller why a command - was refused or failed + was refused or failed. The messages are written without color !*/ Builder::new() .filter_level(if debug { LevelFilter::Debug } else { LevelFilter::Error }) - .write_style(WriteStyle::Always) + .write_style(WriteStyle::Never) .init(); } diff --git a/podman-pilot/src/main.rs b/podman-pilot/src/main.rs index 830cb1c..323e5cb 100644 --- a/podman-pilot/src/main.rs +++ b/podman-pilot/src/main.rs @@ -108,7 +108,7 @@ fn run_through_helper() -> ExitCode { fn setup_logger() { let env = Env::default() .filter_or("FLAKE_LOG_LEVEL", "debug") - .write_style_or("FLAKE_LOG_STYLE", "always"); + .write_style_or("FLAKE_LOG_STYLE", "never"); env_logger::init_from_env(env); } diff --git a/podman-pilot/src/podman.rs b/podman-pilot/src/podman.rs index 4c4c195..00df88a 100644 --- a/podman-pilot/src/podman.rs +++ b/podman-pilot/src/podman.rs @@ -49,7 +49,7 @@ use std::os::unix::process::CommandExt; use std::io::Seek; use std::io::SeekFrom; -use spinoff::{Spinner, spinners, Color}; +use spinoff::{Spinner, spinners}; use tempfile::tempfile; use tempfile::NamedTempFile; use regex::Regex; @@ -339,7 +339,7 @@ pub fn create( spinner = Some( Spinner::new_with_stream( spinners::Line, "Launching flake...", - Color::Yellow, spinoff::Streams::Stderr + None, spinoff::Streams::Stderr ) ); } @@ -354,13 +354,13 @@ pub fn create( ) { Ok(cid) => { if let Some(spinner) = spinner { - spinner.success("Launching flake"); + spinner.stop_and_persist("✓", "Launching flake"); } Ok((cid, container_cid_file)) }, Err(err) => { if let Some(spinner) = spinner { - spinner.fail("Flake launch has failed"); + spinner.stop_and_persist("✗", "Flake launch has failed"); } Err(err) },