Use compact formatting for tracing if running through cargo
Some checks failed
Build and deploy / Build container and manifests (push) Has been cancelled
Some checks failed
Build and deploy / Build container and manifests (push) Has been cancelled
This commit is contained in:
parent
77331c5080
commit
379ae5e80f
|
@ -33,12 +33,17 @@ async fn log_status<T>(
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
let logger = tracing_subscriber::fmt::layer().json();
|
||||
let env_filter = EnvFilter::try_from_default_env()
|
||||
.or_else(|_| EnvFilter::try_new("info"))
|
||||
.expect("Fallback should be valid");
|
||||
|
||||
if std::env::var("CARGO").is_ok() {
|
||||
let logger = tracing_subscriber::fmt::layer().compact();
|
||||
Registry::default().with(logger).with(env_filter).init();
|
||||
} else {
|
||||
let logger = tracing_subscriber::fmt::layer().json();
|
||||
Registry::default().with(logger).with(env_filter).init();
|
||||
}
|
||||
|
||||
info!("Starting controller");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user