Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ts_elixir/native/ts_elixir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tailscale = { workspace = true }

tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[lib]
crate-type = ["cdylib"]
Expand Down
18 changes: 17 additions & 1 deletion ts_elixir/native/ts_elixir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ use std::{
collections::HashMap,
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
str::FromStr,
sync::{Arc, LazyLock},
sync::{Arc, LazyLock, Once},
};

use rustler::{Encoder, NifResult, ResourceArc, Term};
use tracing::level_filters::LevelFilter;

mod config;
mod tcp;
Expand Down Expand Up @@ -103,6 +104,21 @@ where
Ok(ResourceArc::new(t))
}

#[rustler::nif]
fn start_tracing() {
static TRACING_ONCE: Once = Once::new();

TRACING_ONCE.call_once(|| {
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::builder()
.with_default_directive(LevelFilter::INFO.into())
.from_env_lossy(),
)
.init();
});
}

#[rustler::nif(schedule = "DirtyIo")]
fn connect<'env>(
env: rustler::Env<'env>,
Expand Down
Loading