Skip to content

Commit 6a77d2f

Browse files
authored
Add additional logging (#71)
1 parent 809d3a4 commit 6a77d2f

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

ScipDotnet/IndexCommandHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ private static async Task ScipIndex(IHost host, IndexCommandOptions options)
7777
index.Documents.Add(document);
7878
}
7979

80+
if (index.Documents.Count <= 0)
81+
{
82+
options.Logger.LogWarning("Indexing finished without error but no documents were indexed.");
83+
}
84+
8085
await File.WriteAllBytesAsync(options.Output.FullName, index.ToByteArray());
8186
options.Logger.LogInformation("done: {OptionsOutput} {TimeElapsed}", options.Output,
8287
stopwatch.Elapsed.ToFriendlyString());

ScipDotnet/ScipProjectIndexer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ await host.Services.GetRequiredService<MSBuildWorkspace>()
7474
.OpenSolutionAsync(rootProject.FullName)).Projects).ToList();
7575

7676

77+
options.Logger.LogDebug($"Found {projects.Count()} projects");
7778
var projectsPerProjFile = projects.GroupBy(x => x.FilePath);
7879
var framework = $"net{Environment.Version.Major}.0";
7980
foreach (var projectGroup in projectsPerProjFile)
@@ -101,6 +102,7 @@ await host.Services.GetRequiredService<MSBuildWorkspace>()
101102

102103
var globals = new Dictionary<ISymbol, ScipSymbol>(SymbolEqualityComparer.Default);
103104

105+
options.Logger.LogDebug($"Found {project.Documents.Count()} documents in {projectGroup.Key}");
104106
foreach (var document in project.Documents)
105107
{
106108
if (options.Matcher.Match(options.WorkingDirectory.FullName, document.FilePath).HasMatches)

readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ A total of 1 test files matched the specified pattern.
115115
If you're happy with the new behavior, run
116116
`SCIP_UPDATE_SNAPSHOTS=true dotnet test` to update the snapshot tests.
117117

118+
## Logging
119+
120+
By default, only logs of warning level or higher are shown. To show debug logs set the following environment variable before running scip-dotnet
121+
122+
```
123+
export Logging__LogLevel__Default=Debug
124+
```
125+
118126
## Releasing a new version
119127

120128
First, make sure that you are on the latest `main` branch and have no dirty

0 commit comments

Comments
 (0)