#![allow(warnings)]
#![feature(exclusive_range_pattern)]

pub mod ali_sls;
pub mod encode_json;
pub mod encode_json_str;
pub mod encode_sls;
pub mod http;
// pub mod tracing;
pub mod opentelemetry;

// 导出 SLS 批量配置
pub use ali_sls::SLBatchConfig;

#[macro_use]
extern crate lazy_static;

mod env_util {
    pub fn expand_env_vars(path: std::path::PathBuf) -> std::path::PathBuf {
        let mut path: String = path.to_string_lossy().into();
        let matcher = regex::Regex::new(r#"\$ENV\{([\w][\w|\d|\.|_]*)\}"#).unwrap();
        matcher.captures_iter(&path.clone()).for_each(|c| {
            if let Ok(s) = std::env::var(&c[1]) {
                path = path.replace(&c[0], &s);
            }
        });
        path.into()
    }
}

#[allow(dead_code)]
#[cfg(windows)]
const NEWLINE: &'static str = "\r\n";

#[allow(dead_code)]
#[cfg(not(windows))]
const NEWLINE: &str = "\n";
