jyotish 1.0.0

Jyotish — astronomical computation engine for planetary positions, calendar systems, and celestial event prediction
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Logging initialization for the jyotish crate.
//!
//! Requires the `logging` feature. Uses the `JYOTISH_LOG` environment variable
//! to control filter levels (defaults to `warn`).

/// Initialize tracing with the `JYOTISH_LOG` environment variable.
///
/// Returns `Ok(())` on success, or an error if the global subscriber has
/// already been set.
pub fn try_init() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> {
    use tracing_subscriber::EnvFilter;
    let filter = EnvFilter::try_from_env("JYOTISH_LOG").unwrap_or_else(|_| EnvFilter::new("warn"));
    tracing_subscriber::fmt().with_env_filter(filter).try_init()
}