openzeppelin_relayer/utils/
service_info_log.rs

1//! This module contains the function to log service information at startup.
2use std::env;
3use tracing::info;
4
5/// Logs service information at startup
6pub fn log_service_info() {
7    let service_name = env!("CARGO_PKG_NAME");
8    let service_version = env!("CARGO_PKG_VERSION");
9
10    info!("=== OpenZeppelin Relayer Service Starting ===");
11    info!(service_name = %service_name, service_version = %service_version, "🚀 service");
12    info!(rust_version = %env!("CARGO_PKG_RUST_VERSION"), "đŸĻ€ rust version");
13
14    // Log environment information
15    if let Ok(profile) = env::var("CARGO_PKG_PROFILE") {
16        info!(profile = %profile, "🔧 build profile");
17    }
18
19    // Log system information
20    info!(platform = %env::consts::OS, "đŸ’ģ platform");
21    info!(architecture = %env::consts::ARCH, "đŸ’ģ architecture");
22
23    // Log current working directory
24    if let Ok(cwd) = env::current_dir() {
25        info!(working_directory = %cwd.display(), "📁 working directory");
26    }
27
28    // Log important environment variables if present
29    if let Ok(rust_log) = env::var("RUST_LOG") {
30        info!(log_level = %rust_log, "🔧 log level");
31    }
32
33    if let Ok(config_path) = env::var("CONFIG_PATH") {
34        info!(config_path = %config_path, "🔧 config path");
35    }
36
37    // Log startup timestamp
38    info!(
39        started_at = %chrono::Utc::now().format("%Y-%m-%d %H:%M:%S UTC"),
40        "🕒 started at"
41    );
42
43    // log docs url
44    info!("â„šī¸ Visit the Relayer documentation for more information https://docs.openzeppelin.com/relayer/");
45}