text stringlengths 70 351k | source stringclasses 4
values |
|---|---|
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/webhooks.rs | crate: api_models
use crate::payouts;
pub type MerchantWebhookConfig = std::collections::HashSet<IncomingWebhookEvent>;
fn from(evt: IncomingWebhookEvent) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/webhooks.rs | crate: api_models
use common_utils::custom_serde;
use crate::payouts;
use crate::{disputes, enums as api_enums, mandates, payments, refunds};
pub type MerchantWebhookConfig = std::collections::HashSet<IncomingWebhookEvent>;
pub fn get_connector_tra... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/webhooks.rs | crate: api_models
use crate::payouts;
pub type MerchantWebhookConfig = std::collections::HashSet<IncomingWebhookEvent>;
fn from(evt: IncomingWebhookEvent) -> Self {
{
IncomingWebhookEvent::PaymentIntentFailure
| IncomingWebhookEvent::Pa... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/webhooks.rs | crate: api_models
pub type MerchantWebhookConfig = std::collections::HashSet<IncomingWebhookEvent>;
pub fn is_recovery_transaction_event(&self) -> bool {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/webhooks.rs | crate: api_models
use common_utils::custom_serde;
use crate::payouts;
pub type MerchantWebhookConfig = std::collections::HashSet<IncomingWebhookEvent>;
pub fn get_payment_id(&self) -> Option<common_utils::id_type::GlobalPaymentId> {
{<|fim_suffix|>... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/webhooks.rs | crate: api_models
use common_utils::custom_serde;
use crate::payouts;
pub type MerchantWebhookConfig = std::collections::HashSet<IncomingWebhookEvent>;
pub fn get_payment_id(&self) -> Option<common_utils::id_type::PaymentId> {
{
Self::Payment { pay... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
fn from(expiration: ApiKeyExpiration) -> Self {
{
ApiKeyExpiration::Never => None,<|fim_suffix|>
<|fim_middle|>
ApiKeyExpiration::DateTime(date_time) => Some(date_time),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
fn test_null() {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
use time::PrimitiveDateTime;
fn test_deserialization() {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
use time::PrimitiveDateTime;
fn test_serialization() {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
use common_utils::custom_serde;
use masking::StrongSecret;
use serde::{Deserialize, Serialize};
use time::PrimitiveDateTime;
use utoipa::ToSchema;
fn schema() -> (
&'a str,
utoipa::openapi::RefOr<utoipa::openapi::s... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
use serde::{Deserialize, Serialize};
pub fn deserialize<'de, D>(deserializer: D) -> Result<(), D::Error>
where
D: serde::Deserializer<'de>,
{
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
use serde::{Deserialize, Serialize};
fn visit_str<E: serde::de::Error>(self, value: &str) -> Result<Self::Value, E> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
use serde::{Deserialize, Serialize};
pub fn serialize<S>(serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
use time::PrimitiveDateTime;
fn from(date_time: Option<PrimitiveDateTime>) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/api_keys.rs | crate: api_models
fn from(expiration: ApiKeyExpiration) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics.rs | crate: api_models
use self::{
active_payments::ActivePaymentsMetrics,
api_event::{ApiEventDimensions, ApiEventMetrics},
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetrics},
disputes::{DisputeDimensions, DisputeMe... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics.rs | crate: api_models
use self::{
active_payments::ActivePaymentsMetrics,
api_event::{ApiEventDimensions, ApiEventMetrics},
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetrics},
disputes::{DisputeDimensions, DisputeMe... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics.rs | crate: api_models
pub use common_utils::types::TimeRange;
use self::{
active_payments::ActivePaymentsMetrics,
api_event::{ApiEventDimensions, ApiEventMetrics},
auth_events::{AuthEventDimensions, AuthEventFilters, AuthEventMetrics},
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/health_check.rs | crate: api_models
fn from(value: HealthState) -> Self {
{
HealthState::Running => Some(true),<|fim_suffix|>
<|fim_middle|>
HealthState::NotApplicable => None,
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/health_check.rs | crate: api_models
fn from(value: HealthState) -> Self {
{
HealthState::Running => true,<|fim_suffix|>
<|fim_middle|>
HealthState::Error | HealthState::NotApplicable => false,
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/health_check.rs | crate: api_models
fn from(value: HealthState) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use masking::{PeekInterface, Secret};
pub fn get_frm_config_as_secret(&self) -> Optio... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_connector_label(&self, profile_name: String) -> String {
{<|fim_suffix|>
<... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn validate(&self) -> Result<(), &str> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use std::collections::{HashMap, HashSet};
use masking::{PeekInterface, Secret};
pub fn from_headers(headers: HashMap<String, Secret<String>>) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
fn mask_value(value: &str) -> String {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use crate::{
consts::{MAX_ORDER_FULFILLMENT_EXPIRY, MIN_ORDER_FULFILLMENT_EXPIRY}... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use masking::{PeekInterface, Secret};
pub fn get_frm_config_as_secret(&self) -> Optio... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_connector_name(&self) -> common_enums::connector_enums::Connector {
{<|fim... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn to_merchant_connector_info(&self, connector_label: &String) -> MerchantConnect... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_connector_name(&self) -> String {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn new(
connector_label: String,
merchant_connector_id: id_type::... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use crate::{
consts::{MAX_ORDER_FULFILLMENT_EXPIRY, MIN_ORDER_FULFILLMENT_EXPIRY}... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_connector_label(&self, profile_name: String) -> String {
{
Some(connector_... | ast_fragments |
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use masking::{PeekInterface, Secret};
pub fn get_frm_config_as_secret(&self) -> Option<Vec<Secret<se... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use masking::{PeekInterface, Secret};
pub fn get_metadata_as_secret(
&self,
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use masking::{PeekInterface, Secret};
pub fn get_merchant_details_as_secret(
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_enable_payment_response_hash(&self) -> bool {
<|fim_suffix|>
<|fim_middle|... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use crate::routing;
pub fn parse_routing_algorithm(&self) -> CustomResult<(), errors:... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_webhook_details_as_value(
&self,
) -> CustomResult<Option<serd... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_pm_link_config_as_value(
&self,
) -> CustomResult<Option<serde... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_primary_details_as_value(
&self,
) -> CustomResult<Option<serd... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_primary_details_as_value(
&self,
) -> CustomResult<serde_json:... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
pub fn get_merchant_reference_id(&self) -> id_type::MerchantId {
{<|fim_suffix|>
<|fi... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/admin.rs | crate: api_models
use common_utils::{
consts,
crypto::Encryptable,
errors::{self, CustomResult},
ext_traits::Encode,
id_type, link_utils, pii,
};
use common_utils::{crypto::OptionalEncryptableName, ext_traits::ValueExt};
pub fn get... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/payments/trait_impls.rs | crate: api_models
use common_enums::enums;
use common_utils::errors;
use crate::payments;
fn validate_field_and_get(
&self,
request: &payments::PaymentsRequest,
) -> errors::CustomResult<Self, errors::ValidationError... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/payments/trait_impls.rs | crate: api_models
use common_enums::enums;
use common_utils::errors;
use crate::payments;
fn validate_field_and_get(
&self,
request: &payments::PaymentsRequest,
) -> errors::CustomResult<Self, errors::ValidationError... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/errors/types.rs | crate: api_models
pub(crate) fn error_type(&self) -> &'static str {
{
Self::Unauthorized(_)
| Self::ForbiddenCommonResource(_)
| Self::ForbiddenPrivateResource(_)
| Self::Conflict(_)
| Self::Gone(... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/errors/types.rs | crate: api_models
pub(crate) fn error_type(&self) -> &'static str {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/errors/types.rs | crate: api_models
pub fn get_internal_error_mut(&mut self) -> &mut ApiError {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/errors/types.rs | crate: api_models
pub(crate) fn get_internal_error(&self) -> &ApiError {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/errors/types.rs | crate: api_models
use std::borrow::Cow;
fn from(value: &'a ApiErrorResponse) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/errors/types.rs | crate: api_models
pub fn new(
sub_code: &'static str,
error_identifier: u16,
error_message: impl ToString,
extra: Option<Extra>,
) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/refunds.rs | crate: api_models
fn from(value: RefundDimensions) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/refunds.rs | crate: api_models
use crate::enums::{Currency, RefundStatus};
use super::{ForexMetric, NameDescription, TimeRange};
pub fn new(
currency: Option<Currency>,
refund_status: Option<String>,
connector: Option<String>,
... | ast_fragments |
// file: hyperswitch/crates/api_models/src/analytics/refunds.rs | crate: api_models
fn from(value: RefundDimensions) -> Self {
Self {
name: value.to_string(),
desc: String::new(),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/refunds.rs | crate: api_models
fn from(value: RefundMetrics) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/auth_events.rs | crate: api_models
fn from(value: AuthEventDimensions) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/api_models/src/analytics/auth_events.rs | crate: api_models
use std::{
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
fn hash<H: Hasher>(&self, state: &mut H) {
self.authentication_status.hash(state);
self.trans_status.hash(state);
self.authent... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/auth_events.rs | crate: api_models
use common_enums::{
AuthenticationConnectors, AuthenticationStatus, DecoupledAuthenticationType, TransactionStatus,
};
use super::{NameDescription, TimeRange};
pub fn new(
authentication_status: Option<Aut... | ast_fragments |
// file: hyperswitch/crates/api_models/src/analytics/auth_events.rs | crate: api_models
fn from(value: AuthEventDimensions) -> Self {
Self {
name: value.to_string(),
desc: String::new(),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/api_models/src/analytics/auth_events.rs | crate: api_models
fn from(value: AuthEventMetrics) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
use serde::ser::{SerializeMap, Serializer};
use serde_json::{ser::Formatter, Value};
use tracing::{Event, Metadata, Subscriber};
use tracing_subscr... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
use config::ConfigError;
use serde_json::{ser::Formatter, Value};
use tracing_subscriber::{
fmt::MakeWriter,
layer::Context,
registry::... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
use serde::ser::{SerializeMap, Serializer};
use serde_json::{ser::Formatter, Value};
use time::format_description::well_known::Iso8601;
use tracing... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
use config::ConfigError;
///
/// A `name` will be attached to all records during formatting.
/// A `dst_writer` to forward all records.... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use tracing::{Event, Metadata, Subscriber};
use tracing_subscriber::{
fmt::MakeWriter,
layer::Context,
registry::{LookupSpan, SpanRef},
Layer,
};
fn on_close(&self, id: tracing::Id, ctx: Context<'_, S>) {
<... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use tracing::{Event, Metadata, Subscriber};
use tracing_subscriber::{
fmt::MakeWriter,
layer::Context,
registry::{LookupSpan, SpanRef},
Layer,
};
fn on_enter(&self, id: &tracing::Id, ctx: Context<'_, S>) {
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
use tracing::{Event, Metadata, Subscriber};
use tracing_subscriber::{
fmt::MakeWriter,
layer::Context,
registry::{LookupSpan, SpanRef},... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use serde_json::{ser::Formatter, Value};
use tracing::{Event, Metadata, Subscriber};
use tracing_subscriber::{
fmt::MakeWriter,
layer::Context,
registry::{LookupSpan, SpanRef},
Layer,
};
use crate::Storage;... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use tracing::{Event, Metadata, Subscriber};
use tracing_subscriber::{
fmt::MakeWriter,
layer::Context,
registry::{LookupSpan, SpanRef},
Layer,
};
/// Format message of a span.
///
/// Example: "... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
use serde::ser::{SerializeMap, Serializer};
use serde_json::{ser::Formatter, Value};
use tracing::{Event, Metadata, Subscriber};
use tracing_subscr... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
/// Flush memory buffer into an output stream trailing it with next line.
///
/// Should be done by single `write_all` call to avoid fr... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
use config::ConfigError;
/// Constructor of `FormattingLayer`.
///
/// A `name` will be attached to all records during formatting.
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/formatter.rs | crate: router_env
use std::{
collections::{HashMap, HashSet},
fmt,
io::Write,
};
use serde::ser::{SerializeMap, Serializer};
use serde_json::{ser::Formatter, Value};
use time::format_description::well_known::Iso8601;
use tracing... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use std::{collections::HashMap, fmt, time::Instant};
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
use tracing_subscriber::{layer::Context, Layer};
/// On close create a... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use std::{collections::HashMap, fmt, time::Instant};
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
/// Otherwise.
fn record_debug(&mut self, field: &Field, value: &dyn f... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use std::{collections::HashMap, fmt, time::Instant};
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
use tracing_subscriber::{layer::Context, Layer};
/// On enter store ti... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
use tracing_subscriber::{layer::Context, Layer};
/// On additional key value pairs store it.
fn on_record(&self, span: &Id,... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
use tracing_subscriber::{layer::Context, Layer};
/// On new span.
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ct... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use std::{collections::HashMap, fmt, time::Instant};
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
/// Otherwise.
fn record_debug(&mut self, field: &Field, value: &dyn f... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
/// A string.
fn record_str(&mut self, field: &Field, value: &str) {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
/// A boolean.
fn record_bool(&mut self, field: &Field, value: bool) {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
/// A 64-bit floating point.
fn record_f64(&mut self, field: &Field, value: f64) {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
/// A u64.
fn record_u64(&mut self, field: &Field, value: u64) {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
/// A i64.
fn record_i64(&mut self, field: &Field, value: i64) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
use tracing::{
field::{Field, Visit},
span::{Attributes, Record},
Id, Subscriber,
};
pub fn record_value(&mut self, key: &'a str, value: serde_json::Value) {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/storage.rs | crate: router_env
/// Default constructor.
pub fn new() -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
use std::time::Duration;
use ::config::ConfigError;
use tracing_subscriber::{fmt, prelude::*, util::SubscriberInitExt, EnvFilter, Layer};
use crate::{config, FormattingLayer, StorageSubscription};
fn get_envfilter(
filteri... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
use std::time::Duration;
use ::config::ConfigError;
use serde_json::ser::{CompactFormatter, PrettyFormatter};
use tracing_appender::non_blocking::WorkerGuard;
use tracing_subscriber::{fmt, prelude::*, util::SubscriberInitExt, ... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
use std::time::Duration;
use ::config::ConfigError;
use serde_json::ser::{CompactFormatter, PrettyFormatter};
use tracing_appender::non_blocking::WorkerGuard;
use tracing_subscriber::{fmt, prelude::*, util::SubscriberInitExt, ... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
use std::time::Duration;
use ::config::ConfigError;
use serde_json::ser::{CompactFormatter, PrettyFormatter};
use tracing_appender::non_blocking::WorkerGuard;
use tracing_subscriber::{fmt, prelude::*, util::SubscriberInitExt, ... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
/// Should the provided url be traced
fn should_trace_url(&self, url: &str) -> bool {
{
Some(clauses) => clauses.iter().all(|cur| cur.compare_url(url)),<|fim_suffix|>
<|fim_middle|>
None => self.default,
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
fn from(value: String) -> Self {
{
url if url.starts_with('*') => Self::EndsWith(url.trim_start_matches('*').to_string()),<|fim_suffix|>
<|fim_middle|>
url => Self::Match(url),
}
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
/// Should the provided url be traced
fn should_trace_url(&self, url: &str) -> bool {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
fn compare_url(&self, url: &str) -> bool {
match self {
Self::Match(value) => url == value,
Self::EndsWith(end) => url.ends_with(end),
}
} | ast_fragments |
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
use std::time::Duration;
use ::config::ConfigError;
use crate::{config, FormattingLayer, StorageSubscription};
fn get_opentelemetry_exporter_config(
config: &config::LogTelemetry,
) -> opentelemetry_otlp::ExportConfig {
let mut expor... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/router_env/src/logger/setup.rs | crate: router_env
use std::time::Duration;
use ::config::ConfigError;
use serde_json::ser::{CompactFormatter, PrettyFormatter};
use tracing_appender::non_blocking::WorkerGuard;
use tracing_subscriber::{fmt, prelude::*, util::SubscriberInitExt, ... | ast_fragments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.