Skip to content

Commit

Permalink
chore: disable ansi codes when in GCP (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
itegulov authored Apr 25, 2023
1 parent 5d0d59a commit d16f39f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mpc-recovery/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,14 @@ async fn load_account_creator_sk(

#[tokio::main]
async fn main() -> anyhow::Result<()> {
// install global collector configured based on RUST_LOG env var.
tracing_subscriber::fmt::init();
// Install global collector configured based on RUST_LOG env var.
let mut subscriber = tracing_subscriber::fmt();
// Check if running in Google Cloud Run: https://cloud.google.com/run/docs/container-contract#services-env-vars
if std::env::var("K_SERVICE").is_ok() {
// Disable colored logging as it messes up Google's log formatting
subscriber = subscriber.with_ansi(false);
}
subscriber.init();
let _span = tracing::trace_span!("cli").entered();

match Cli::parse() {
Expand Down

0 comments on commit d16f39f

Please sign in to comment.