Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bubblewrap-pilot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn run() -> Result<ExitCode, 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);
}
11 changes: 7 additions & 4 deletions doc/user_guide/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============
Expand Down
2 changes: 1 addition & 1 deletion firecracker-pilot/guestvm-tools/sci/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions firecracker-pilot/src/firecracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -252,21 +252,21 @@ 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
)
);
}

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)
},
Expand Down
2 changes: 1 addition & 1 deletion firecracker-pilot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions flake-ctl/src/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
2 changes: 1 addition & 1 deletion flake-ctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ fn init_flakes_dir(usermode: bool) -> Result<(), Box<dyn std::error::Error>> {
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);
}
4 changes: 2 additions & 2 deletions flake-pilot-helper/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion podman-pilot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
8 changes: 4 additions & 4 deletions podman-pilot/src/podman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
)
);
}
Expand All @@ -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)
},
Expand Down
Loading