More logging information in WaitInvoice method

This commit is contained in:
rockstardev
2025-06-20 21:37:06 +02:00
parent 625ee7fbb8
commit cf82e88e05
2 changed files with 23 additions and 2 deletions

View File

@@ -9,7 +9,7 @@
<PropertyGroup>
<Product>Blink</Product>
<Description>Blink Lightning support</Description>
<Version>1.0.11</Version>
<Version>1.0.12</Version>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RootNamespace>BTCPayServer.Plugins.Blink</RootNamespace>
</PropertyGroup>

View File

@@ -493,7 +493,28 @@ expiresIn = (int)createInvoiceRequest.Expiry.TotalMinutes
return await res;
}
_logger.LogInformation("Stream disconnected, cannot await invoice. resultsz: "+ resultz);
// Enhanced logging to identify which task completed and its details
var taskType = resultz.GetType();
var typeName = taskType.Name.Contains('`') ? taskType.Name.Split('`')[0] : taskType.Name;
var genericArgs = taskType.GenericTypeArguments;
var genericTypeInfo = genericArgs.Length > 0
? $"<{string.Join(", ", genericArgs.Select(t => t.Name))}>"
: "";
_logger.LogInformation("WaitInvoice completed - Task Type: {TaskType}{GenericArgs}, " +
"Status: {Status}, IsCompletedSuccessfully: {IsCompletedSuccessfully}, " +
"IsFaulted: {IsFaulted}",
typeName,
genericTypeInfo,
resultz.Status,
resultz.IsCompletedSuccessfully,
resultz.IsFaulted);
if (resultz.IsFaulted && resultz.Exception != null)
{
_logger.LogError("Task completed with fault: {Exception}", resultz.Exception);
}
return new LightningInvoice { Id = Guid.NewGuid().ToString() }; // Return a dummy invoice so calling listening logic exits
}
}