Use compact formatting for tracing if running through cargo
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 7m23s
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 7m23s
This commit is contained in:
parent
31354f8a83
commit
b9963dcb16
|
@ -33,12 +33,17 @@ async fn log_status<T>(
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
let logger = tracing_subscriber::fmt::layer().json();
|
|
||||||
let env_filter = EnvFilter::try_from_default_env()
|
let env_filter = EnvFilter::try_from_default_env()
|
||||||
.or_else(|_| EnvFilter::try_new("info"))
|
.or_else(|_| EnvFilter::try_new("info"))
|
||||||
.expect("Fallback should be valid");
|
.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();
|
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");
|
info!("Starting controller");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user