Skip to content

Commit 88c3678

Browse files
committed
Add logging
1 parent 6097ebf commit 88c3678

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

VpmRepository.Build/Build.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,15 @@ async IAsyncEnumerable<VpmPackageManifest> GetReleasedVpmPackageManifests(string
202202
{
203203
var repository = await GitHubClient.Repository.Get(owner, name) ?? throw new ArgumentException($"Repository {owner}/{name} not found.");
204204

205+
Serilog.Log.Information($"Fetching releases for {owner}/{name}...");
206+
205207
var releases = await GitHubClient.Repository.Release.GetAll(owner, name);
206208

207209
foreach (var release in releases)
208210
{
209211
if(release.Assets.Any(asset => asset.Name == "package.json") && release.Assets.FirstOrDefault(asset => asset.Name.EndsWith(".zip")) is { } packageZipAsset)
210212
{
213+
Serilog.Log.Information($"Found release {release.Name} ({release.TagName}) for {owner}/{name} with package.json and zip asset.");
211214
// Octokit does not exposes asset digest which contains SHA256 hash of the package zip, so we need to download it and compute hash manually.
212215
// To compute SHA256 hash of the package zip, we need to download it.
213216
var packageZipDownloadUrl = packageZipAsset.BrowserDownloadUrl;
@@ -226,6 +229,7 @@ async IAsyncEnumerable<VpmPackageManifest> GetReleasedVpmPackageManifests(string
226229
{
227230
if(existingPackageManifests.TryGetValue(packageZipUrl, out var existingPackageManifest))
228231
{
232+
Serilog.Log.Information($"Using existing package manifest for {packageZipUrl}");
229233
return existingPackageManifest;
230234
}
231235
var packageZipDownloadResponse = await HttpClient.GetAsync(packageZipUrl, HttpCompletionOption.ResponseContentRead);
@@ -237,12 +241,14 @@ async IAsyncEnumerable<VpmPackageManifest> GetReleasedVpmPackageManifests(string
237241
var packageJsonEntry = packageZip.GetEntry("package.json");
238242
if (packageJsonEntry is null)
239243
{
244+
Serilog.Log.Warning($"No package.json found in {packageZipUrl}. Skipping.");
240245
return null;
241246
}
242247
var packageManifest = await JsonSerializer.DeserializeAsync<VpmPackageManifest>(packageJsonEntry.Open(), JsonSerializerOptions);
243248

244249
if (packageManifest is null)
245250
{
251+
Serilog.Log.Warning($"Failed to deserialize package.json from {packageZipUrl}. The file may be corrupted or in an unsupported format.");
246252
return null;
247253
}
248254

0 commit comments

Comments
 (0)