Skip to content

Commit

Permalink
log snippet keys (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Sep 15, 2021
1 parent a341713 commit 5e860d6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/MarkdownSnippets/Processing/DirectoryMarkdownProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ void InitNewLine()

public void AddSnippets(List<Snippet> snippets)
{
var stopwatch = Stopwatch.StartNew();
var files = snippets
.Where(x => x.Path != null)
.Select(x => x.Path!)
Expand All @@ -186,13 +185,11 @@ public void AddSnippets(List<Snippet> snippets)
if (files.Any())
{
snippetSourceFiles.AddRange(files);
log($"Added {files.Count} files for snippets");
}

if (snippets.Any())
{
this.snippets.AddRange(snippets);
log($"Added {snippets.Count} snippets ({stopwatch.ElapsedMilliseconds}ms)");
}
}

Expand Down Expand Up @@ -226,6 +223,23 @@ public void Run()
}}");
}

foreach (var group in snippets.GroupBy(x=>x.Path))
{
if (group.Key == null)
{
log("Snippets added with no path");
}
else
{
log($"Snippets extracted from {group.Key}");
}

foreach (var snippet in group)
{
log($"\t{snippet.Key}");
}
}

var stopwatch = Stopwatch.StartNew();
MarkdownProcessor processor = new(
convention,
Expand Down

0 comments on commit 5e860d6

Please sign in to comment.