From 60bd3163a9a28cebd0d4cb295866b30311ae9e22 Mon Sep 17 00:00:00 2001 From: duffyduck Date: Fri, 3 Apr 2026 12:13:43 +0200 Subject: [PATCH] Add debug logging for raw Starface API contact data Logs the first contact from Starface API response into the sync log so we can see the actual JSON structure and fix field mapping. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/StarfaceOutlookSync/Services/StarfaceApiClient.cs | 10 ++++++++++ src/StarfaceOutlookSync/Services/SyncEngine.cs | 1 + 2 files changed, 11 insertions(+) diff --git a/src/StarfaceOutlookSync/Services/StarfaceApiClient.cs b/src/StarfaceOutlookSync/Services/StarfaceApiClient.cs index 6a31665e..8d1e27dd 100644 --- a/src/StarfaceOutlookSync/Services/StarfaceApiClient.cs +++ b/src/StarfaceOutlookSync/Services/StarfaceApiClient.cs @@ -155,11 +155,14 @@ namespace StarfaceOutlookSync.Services return books; } + public event Action OnDebug; + public async Task> GetContactsAsync(StarfaceAddressBook book) { var contacts = new List(); int page = 0; const int pageSize = 200; + bool firstPage = true; while (true) { @@ -206,6 +209,13 @@ namespace StarfaceOutlookSync.Services if (array.Count == 0) break; + // Ersten Kontakt als Debug-Info loggen + if (firstPage && array.Count > 0) + { + OnDebug?.Invoke($"Starface API Rohdaten (1. Kontakt):\n{array[0].ToString(Formatting.Indented)}"); + firstPage = false; + } + foreach (var item in array) contacts.Add(MapFromStarface(item)); diff --git a/src/StarfaceOutlookSync/Services/SyncEngine.cs b/src/StarfaceOutlookSync/Services/SyncEngine.cs index 1fb2b332..1ddc4bc0 100644 --- a/src/StarfaceOutlookSync/Services/SyncEngine.cs +++ b/src/StarfaceOutlookSync/Services/SyncEngine.cs @@ -53,6 +53,7 @@ namespace StarfaceOutlookSync.Services Log("Verbinde mit Starface..."); using (var starface = new StarfaceApiClient(profile.StarfaceConnection)) { + starface.OnDebug += (msg) => Log(msg); var loginOk = await starface.LoginAsync(); if (!loginOk) {