2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-20 11:21:14 +00:00

Add flag for console

This commit is contained in:
Aode (lion) 2022-02-01 10:10:52 -06:00
parent 38724f6bc1
commit 0e948a2bf5
3 changed files with 8 additions and 3 deletions

View file

@ -1,2 +1,2 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]
# rustflags = ["--cfg", "tokio_unstable"]

View file

@ -10,6 +10,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
console = ["console-subscriber"]
default = ["object-storage"]
object-storage = ["reqwest", "rust-s3"]
io-uring = [
@ -31,7 +32,7 @@ awc = { version = "3.0.0-beta.20", default-features = false, features = [
] }
base64 = "0.13.0"
config = "0.11.0"
console-subscriber = "0.1"
console-subscriber = { version = "0.1", optional = true }
dashmap = "5.0.0"
futures-util = "0.3.17"
mime = "0.3.1"

View file

@ -1,3 +1,4 @@
#[cfg(feature = "console")]
use console_subscriber::ConsoleLayer;
use opentelemetry::{
sdk::{propagation::TraceContextPropagator, Resource},
@ -28,6 +29,7 @@ pub(super) fn init_tracing(
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)
.with_filter(targets.clone());
#[cfg(feature = "console")]
let console_layer = ConsoleLayer::builder()
.with_default_env()
.event_buffer_capacity(1024 * 1024)
@ -36,9 +38,11 @@ pub(super) fn init_tracing(
let subscriber = Registry::default()
.with(format_layer)
.with(console_layer)
.with(ErrorLayer::default());
#[cfg(feature = "console")]
let subscriber = subscriber.with(console_layer);
if let Some(url) = opentelemetry_url {
let tracer =
opentelemetry_otlp::new_pipeline()