You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use clap::Parser;use opentelemetry_log::Opentelemetry;#[derive(Debug,Parser)]#[clap(name = "opentelemetry.rs")]pubstructArgs{#[clap(short, long, value_parser)]puburl:String,#[clap(short, long, value_parser)]pubmessage:String,#[clap(short, long)]publevel:String,}// the async main is not required by our application// but the opentelemetry app is requiring to be// in an async context, so we use this#[tokio::main]asyncfnmain() -> anyhow::Result<()>{let args = Args::parse();let url = args.url;letmut manager = Opentelemetry::new();
manager.init_log("example",&args.level,&url)?;match args.level.as_str(){"info" => log::info!("{}", args.message),"debug" => log::debug!("{}", args.message),
_ => anyhow::bail!("level `{}` not found", args.level),}drop(manager);letmut manager = Opentelemetry::new();
manager.init_log("foo",&args.level,&url)?;match args.level.as_str(){"info" => log::info!("{}", args.message),"debug" => log::debug!("{}", args.message),
_ => anyhow::bail!("level `{}` not found", args.level),}Ok(())}
OpenTelemetry log error occurred. cannot send message to batch processor as the channel is closed Error: attempted to set a logger after the logging system was already initialized
The use case of this is: Immagine that you have a kind of identifier (user identifier) and you need to switch when inside the application it is switching the profile. I am doing something wrong? or this is a real bug?
The text was updated successfully, but these errors were encountered:
I have the following code
Where
drop(mamager)
is just https://github.com/vincenzopalazzo/opentelemetry-log/blob/main/src/lib.rs#L92When dropping I get the following error
A minimal reproducible example of the problem is vincenzopalazzo/opentelemetry-log#3
The use case of this is: Immagine that you have a kind of identifier (user identifier) and you need to switch when inside the application it is switching the profile. I am doing something wrong? or this is a real bug?
The text was updated successfully, but these errors were encountered: