Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified CoDepend/.codepend/snapshot
Binary file not shown.
6 changes: 4 additions & 2 deletions CoDepend/Application/DependencyGraphBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using CoDepend.Domain.Models;
using CoDepend.Domain.Models.Records;
using CoDepend.Domain.Utils;
using CoDepend.Infra;


namespace CoDepend.Application;

Expand Down Expand Up @@ -100,7 +102,7 @@ private async Task TryClassifyItem(
}
}
catch (OperationCanceledException) { throw; }
catch (Exception ex) { await Console.Error.WriteLineAsync($"Error while processing '{item.Value}': {ex}"); }
catch (Exception ex) { Logger.LogError($"Error while processing '{item.Value}': {ex}"); }
}

private async Task<IEnumerable<(RelativePath Parent, RelativePath Item, IReadOnlyList<RelativePath> Deps)>> ParseAllAsync(
Expand Down Expand Up @@ -132,7 +134,7 @@ await Parallel.ForEachAsync(
catch (OperationCanceledException) { throw; }
catch (Exception ex)
{
await Console.Error.WriteLineAsync($"Error while processing '{item.Value}': {ex}");
Logger.LogError($"Error while processing '{item.Value}': {ex}");
return null;
}
}
Expand Down
6 changes: 6 additions & 0 deletions CoDepend/Application/UpdateGraphUseCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using CoDepend.Domain.Interfaces;
using CoDepend.Domain.Models.Enums;
using CoDepend.Domain.Models.Records;
using CoDepend.Infra;

namespace CoDepend.Application;

Expand All @@ -31,10 +32,15 @@ public async Task RunAsync(CancellationToken ct = default)
if (diff)
{
var compareGraph = await snapshotManager.GetLastSavedDependencyGraphAsync(snapshotOptions, ct) ?? throw new InvalidOperationException("Diff mode requires a saved snapshot, but none was found.");
Logger.LogInformation("Running diff use case");
await renderer.RenderDiffViewsAndSaveToFiles(graph, compareGraph, renderOptions, ct);
}
else
{
await renderer.RenderViewsAndSaveToFiles(graph, renderOptions, ct);
Logger.LogInformation("Running non-diff use case");

}
}

await snapshotManager.SaveGraphAsync(graph, snapshotOptions, ct);
Expand Down
11 changes: 10 additions & 1 deletion CoDepend/Domain/DependencyGraphSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using CoDepend.Domain.Models;
using CoDepend.Domain.Models.Records;
using CoDepend.Infra;
using MessagePack;
using MessagePack.Resolvers;

Expand Down Expand Up @@ -109,7 +110,15 @@ public static byte[] Serialize(ProjectDependencyGraph graph, int version = 1)
DependsOn = dependsOn,
};

return MessagePackSerializer.Serialize(dto, MsgPackOptions);
var serialize_data = MessagePackSerializer.Serialize(dto, MsgPackOptions);
if (serialize_data.Length == 0){
Logger.LogWarning($"{serialize_data.Length}");
} else
{
Logger.LogInformation($"{serialize_data.Length}");

}
return serialize_data;
}

public static ProjectDependencyGraph Deserialize(byte[] data, string projectRoot)
Expand Down
23 changes: 23 additions & 0 deletions CoDepend/Infra/Logger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;

namespace CoDepend.Infra;

public class Logger
{
public static void LogInformation(string input)
{
Console.WriteLine($"INFO: {input}");
}


public static void LogWarning (string input){
Console.WriteLine($"WARN: {input}");

}

public static void LogError (string input)
{
Console.WriteLine($"ERROR: {input}");

}
}