diff --git a/src/6.0/Siren.Infrastructure.Io/FileWriter.cs b/src/6.0/Siren.Infrastructure.Io/FileWriter.cs index 0864e90..41618d6 100644 --- a/src/6.0/Siren.Infrastructure.Io/FileWriter.cs +++ b/src/6.0/Siren.Infrastructure.Io/FileWriter.cs @@ -95,7 +95,7 @@ public void Perform( ); // +2 for length of carriage return (otherwise appends line feed each re-write) - var lengthToTrim = MermaidConstants.SirenAnchorEnd.Length + 2; + var lengthToTrim = MermaidConstants.SirenAnchorEnd.Length + Environment.NewLine.Length; if (sirenAnchorEndPosition < 0) { diff --git a/src/6.0/Siren.Infrastructure.Rendering/MermaidRenderer.cs b/src/6.0/Siren.Infrastructure.Rendering/MermaidRenderer.cs index 18f1ce0..5da534c 100644 --- a/src/6.0/Siren.Infrastructure.Rendering/MermaidRenderer.cs +++ b/src/6.0/Siren.Infrastructure.Rendering/MermaidRenderer.cs @@ -2,14 +2,25 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.Extensions.Logging; using Siren.Domain; namespace Siren.Infrastructure.Rendering { public class MermaidRenderer : IDomainRenderer { + private readonly ILogger _logger; + + public MermaidRenderer(ILogger logger) + { + _logger = logger; + } + public StringBuilder Perform(Universe universe) { + _logger + .LogInformation("Commencing render to Mermaid syntax"); + var result = new StringBuilder(); // Text in file replace header @@ -28,6 +39,9 @@ public StringBuilder Perform(Universe universe) result .AppendLine($"\t{MermaidConstants.MermaidErDiagramHeader}"); + _logger + .LogInformation("Rendered header"); + foreach (var entity in universe.Entities) { // Entity header @@ -58,6 +72,9 @@ public StringBuilder Perform(Universe universe) result .AppendLine(); + + _logger + .LogInformation($"Rendered entity: {entity.ShortName}"); } // Entity footer @@ -85,6 +102,9 @@ public StringBuilder Perform(Universe universe) result .AppendLine(MermaidConstants.SirenAnchorEnd); + _logger + .LogInformation("Completed render to Mermaid syntax"); + return result; } diff --git a/src/6.0/Siren.Infrastructure.Rendering/Siren.Infrastructure.Rendering.csproj b/src/6.0/Siren.Infrastructure.Rendering/Siren.Infrastructure.Rendering.csproj index 2344a57..f65765f 100644 --- a/src/6.0/Siren.Infrastructure.Rendering/Siren.Infrastructure.Rendering.csproj +++ b/src/6.0/Siren.Infrastructure.Rendering/Siren.Infrastructure.Rendering.csproj @@ -9,4 +9,8 @@ + + + +