edgee_components_runtime/data_collection/
logger.rs1use tracing::info;
2
3use crate::data_collection::payload::{Consent, EventType};
4
5use super::debug::DebugParams;
6
7pub struct Logger {}
8
9impl Logger {
10 pub fn log_outgoing_event(params: &DebugParams, duration: u128, error: &str) {
11 let path = params.event.context.page.path.clone();
12 let event_type = match params.event.event_type {
13 EventType::Page => "page",
14 EventType::Track => "track",
15 EventType::User => "user",
16 };
17 let consent = match params.event.consent.clone().unwrap() {
18 Consent::Granted => "granted",
19 Consent::Denied => "denied",
20 Consent::Pending => "pending",
21 };
22 info!(
23 project = params.project_id,
24 host = params.proxy_host,
25 from = params.from,
26 ip = params.client_ip,
27 proxy_type = params.proxy_type,
28 proxy_desc = params.proxy_desc,
29 as_name = params.as_name,
30 as_number = params.as_number,
31
32 path = path,
33 consent = consent,
34 event = event_type,
35
36 type = "dc:outgoing-event",
37 component_id = params.component_id,
38 component = params.component_slug,
39 status = params.response_status,
40 duration = duration,
41 message = error
42 );
43 }
44}