mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 19:31:35 +00:00
Add flag for console
This commit is contained in:
parent
38724f6bc1
commit
0e948a2bf5
3 changed files with 8 additions and 3 deletions
|
@ -1,2 +1,2 @@
|
||||||
[build]
|
[build]
|
||||||
rustflags = ["--cfg", "tokio_unstable"]
|
# rustflags = ["--cfg", "tokio_unstable"]
|
||||||
|
|
|
@ -10,6 +10,7 @@ edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
[features]
|
[features]
|
||||||
|
console = ["console-subscriber"]
|
||||||
default = ["object-storage"]
|
default = ["object-storage"]
|
||||||
object-storage = ["reqwest", "rust-s3"]
|
object-storage = ["reqwest", "rust-s3"]
|
||||||
io-uring = [
|
io-uring = [
|
||||||
|
@ -31,7 +32,7 @@ awc = { version = "3.0.0-beta.20", default-features = false, features = [
|
||||||
] }
|
] }
|
||||||
base64 = "0.13.0"
|
base64 = "0.13.0"
|
||||||
config = "0.11.0"
|
config = "0.11.0"
|
||||||
console-subscriber = "0.1"
|
console-subscriber = { version = "0.1", optional = true }
|
||||||
dashmap = "5.0.0"
|
dashmap = "5.0.0"
|
||||||
futures-util = "0.3.17"
|
futures-util = "0.3.17"
|
||||||
mime = "0.3.1"
|
mime = "0.3.1"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#[cfg(feature = "console")]
|
||||||
use console_subscriber::ConsoleLayer;
|
use console_subscriber::ConsoleLayer;
|
||||||
use opentelemetry::{
|
use opentelemetry::{
|
||||||
sdk::{propagation::TraceContextPropagator, Resource},
|
sdk::{propagation::TraceContextPropagator, Resource},
|
||||||
|
@ -28,6 +29,7 @@ pub(super) fn init_tracing(
|
||||||
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)
|
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE)
|
||||||
.with_filter(targets.clone());
|
.with_filter(targets.clone());
|
||||||
|
|
||||||
|
#[cfg(feature = "console")]
|
||||||
let console_layer = ConsoleLayer::builder()
|
let console_layer = ConsoleLayer::builder()
|
||||||
.with_default_env()
|
.with_default_env()
|
||||||
.event_buffer_capacity(1024 * 1024)
|
.event_buffer_capacity(1024 * 1024)
|
||||||
|
@ -36,9 +38,11 @@ pub(super) fn init_tracing(
|
||||||
|
|
||||||
let subscriber = Registry::default()
|
let subscriber = Registry::default()
|
||||||
.with(format_layer)
|
.with(format_layer)
|
||||||
.with(console_layer)
|
|
||||||
.with(ErrorLayer::default());
|
.with(ErrorLayer::default());
|
||||||
|
|
||||||
|
#[cfg(feature = "console")]
|
||||||
|
let subscriber = subscriber.with(console_layer);
|
||||||
|
|
||||||
if let Some(url) = opentelemetry_url {
|
if let Some(url) = opentelemetry_url {
|
||||||
let tracer =
|
let tracer =
|
||||||
opentelemetry_otlp::new_pipeline()
|
opentelemetry_otlp::new_pipeline()
|
||||||
|
|
Loading…
Reference in a new issue