Skip to content

Commit 04ca6d0

Browse files
committed
Terminal logging
1 parent c6a2b3f commit 04ca6d0

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

crates/embucket-lambda/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use http::header::{AUTHORIZATION, CONTENT_TYPE};
2020
use http::{HeaderMap, HeaderValue};
2121
use http_body_util::BodyExt;
2222
use lambda_http::{Body as LambdaBody, Error as LambdaError, Request, Response, run, service_fn};
23+
use std::io::IsTerminal;
2324
use std::net::{IpAddr, SocketAddr};
2425
use std::sync::Arc;
2526
use tokio::time::Duration;
@@ -222,9 +223,11 @@ fn snowflake_error_response(err: &SnowflakeError) -> Response<LambdaBody> {
222223

223224
fn init_tracing() {
224225
let filter = std::env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string());
226+
let emit_ansi = std::io::stdout().is_terminal();
225227
let _ = tracing_subscriber::fmt()
226228
.with_env_filter(filter)
227229
.with_target(true)
230+
.with_ansi(emit_ansi)
228231
.compact()
229232
.try_init();
230233
}

0 commit comments

Comments
 (0)