mirror of
https://github.com/katanemo/plano.git
synced 2026-05-12 01:02:56 +02:00
add support for agents (#564)
This commit is contained in:
parent
f8991a3c4b
commit
96e0732089
41 changed files with 3571 additions and 856 deletions
|
|
@ -1,20 +1,27 @@
|
|||
use std::sync::OnceLock;
|
||||
use std::fmt;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use opentelemetry::global;
|
||||
use opentelemetry_sdk::{propagation::TraceContextPropagator, trace::SdkTracerProvider};
|
||||
use opentelemetry_stdout::SpanExporter;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use tracing_subscriber::fmt::{format, time::FormatTime, FmtContext, FormatEvent, FormatFields};
|
||||
use tracing::{Event, Subscriber};
|
||||
use time::macros::format_description;
|
||||
use tracing::{Event, Subscriber};
|
||||
use tracing_subscriber::fmt::{format, time::FormatTime, FmtContext, FormatEvent, FormatFields};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
struct BracketedTime;
|
||||
|
||||
impl FormatTime for BracketedTime {
|
||||
fn format_time(&self, w: &mut format::Writer<'_>) -> fmt::Result {
|
||||
let now = time::OffsetDateTime::now_utc();
|
||||
write!(w, "[{}]", now.format(&format_description!("[year]-[month]-[day] [hour]:[minute]:[second].[subsecond digits:3]")).unwrap())
|
||||
write!(
|
||||
w,
|
||||
"[{}]",
|
||||
now.format(&format_description!(
|
||||
"[year]-[month]-[day] [hour]:[minute]:[second].[subsecond digits:3]"
|
||||
))
|
||||
.unwrap()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +41,11 @@ where
|
|||
let timer = BracketedTime;
|
||||
timer.format_time(&mut writer)?;
|
||||
|
||||
write!(writer, "[{}] ", event.metadata().level().to_string().to_lowercase())?;
|
||||
write!(
|
||||
writer,
|
||||
"[{}] ",
|
||||
event.metadata().level().to_string().to_lowercase()
|
||||
)?;
|
||||
|
||||
ctx.field_format().format_fields(writer.by_ref(), event)?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue