mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat: add relevant ids for payment calls & make json logs (#908)
This commit is contained in:
@ -40,3 +40,4 @@ default = ["actix_web"]
|
||||
actix_web = ["tracing-actix-web"]
|
||||
log_custom_entries_to_extra = []
|
||||
log_extra_implicit_fields = []
|
||||
log_active_span_json = []
|
||||
|
||||
@ -13,7 +13,7 @@ use serde::ser::{SerializeMap, Serializer};
|
||||
use serde_json::Value;
|
||||
// use time::format_description::well_known::Rfc3339;
|
||||
use time::format_description::well_known::Iso8601;
|
||||
use tracing::{Event, Id, Metadata, Subscriber};
|
||||
use tracing::{Event, Metadata, Subscriber};
|
||||
use tracing_subscriber::{
|
||||
fmt::MakeWriter,
|
||||
layer::Context,
|
||||
@ -282,6 +282,7 @@ where
|
||||
}
|
||||
|
||||
/// Serialize entries of span.
|
||||
#[cfg(feature = "log_active_span_json")]
|
||||
fn span_serialize<S>(
|
||||
&self,
|
||||
span: &SpanRef<'_, S>,
|
||||
@ -407,14 +408,16 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn on_enter(&self, id: &Id, ctx: Context<'_, S>) {
|
||||
#[cfg(feature = "log_active_span_json")]
|
||||
fn on_enter(&self, id: &tracing::Id, ctx: Context<'_, S>) {
|
||||
let span = ctx.span(id).expect("No span");
|
||||
if let Ok(serialized) = self.span_serialize(&span, RecordType::EnterSpan) {
|
||||
let _ = self.flush(serialized);
|
||||
}
|
||||
}
|
||||
|
||||
fn on_close(&self, id: Id, ctx: Context<'_, S>) {
|
||||
#[cfg(feature = "log_active_span_json")]
|
||||
fn on_close(&self, id: tracing::Id, ctx: Context<'_, S>) {
|
||||
let span = ctx.span(&id).expect("No span");
|
||||
if let Ok(serialized) = self.span_serialize(&span, RecordType::ExitSpan) {
|
||||
let _ = self.flush(serialized);
|
||||
|
||||
Reference in New Issue
Block a user