Skip to content

Commit

Permalink
chore(api): add more logging for the API tracker target
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Jan 10, 2025
1 parent 08ccb32 commit 903ec1e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/trackers/api_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,11 @@ where

// Process the response with the extractor script, if specified.
let extractor_response_bytes = if let Some(ref extractor) = target.extractor {
debug!(
tracker.id = %tracker.id,
tracker.name = tracker.name,
"Extracting data with the API target extractor script ({extractor})."
);
let result = self
.execute_script::<ExtractorScriptArgs, ExtractorScriptResult>(
self.get_script_content(tracker, extractor).await?,
Expand All @@ -987,6 +992,12 @@ where

// Deserialize the response body or the extractor result.
let tracker_data_value = if let Some(response_bytes) = extractor_response_bytes {
debug!(
tracker.id = %tracker.id,
tracker.name = tracker.name,
"Extracted data from the API target extractor script with {} bytes.",
response_bytes.len()
);
serde_json::from_slice(&response_bytes).map_err(|err| {
anyhow!(
"Could not deserialize API target extractor result for the tracker ('{}'): {err:?}",
Expand Down

0 comments on commit 903ec1e

Please sign in to comment.