Skip to content

Commit 6a25122

Browse files
AMaini503Aayush Maini
andauthored
Reduce log level for per file level logs in RustSbomDetector (#1603)
* Reduce log level for per file level logs in RustSbomDetector * Reduce log level for fallback ownership * Fix RustSbom UTs * CR: Remove unecessary log --------- Co-authored-by: Aayush Maini <aamaini@microsoft.com>
1 parent b956920 commit 6a25122

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/Microsoft.ComponentDetection.Detectors/rust/Parsers/RustSbomParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private void ApplyOwners(
265265

266266
if (!ownersApplied)
267267
{
268-
this.logger.LogWarning("Falling back to SBOM recorder for {Id} because no ownership found", id);
268+
this.logger.LogDebug("Falling back to SBOM recorder for {Id} because no ownership found", id);
269269

270270
// Fallback to SBOM recorder if no ownership info
271271
fallbackRecorder.RegisterUsage(

src/Microsoft.ComponentDetection.Detectors/rust/RustSbomDetector.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ protected override async Task OnFileFoundAsync(
252252
var normDirectory = this.pathUtilityService.NormalizePath(directory);
253253
var fileName = Path.GetFileName(location);
254254

255-
this.Logger.LogInformation("Processing file: {Location}", normLocation);
256-
257255
// Determine file kind
258256
FileKind fileKind;
259257
if (fileName.Equals(CargoTomlFileName, this.pathComparison))
@@ -272,7 +270,7 @@ protected override async Task OnFileFoundAsync(
272270
// Check if directory should be skipped
273271
if (this.ShouldSkip(directory, fileKind, location))
274272
{
275-
this.Logger.LogInformation("Skipping file due to skip rules: {Location}", normLocation);
273+
this.Logger.LogDebug("Skipping file due to skip rules: {Location}", normLocation);
276274

277275
// Increment skip counters
278276
switch (fileKind)

test/Microsoft.ComponentDetection.Detectors.Tests/RustSbomParserTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ await this.parser.ParseWithOwnershipAsync(
824824
// Verify logger warning was called
825825
this.logger.Verify(
826826
x => x.Log(
827-
LogLevel.Warning,
827+
LogLevel.Debug,
828828
It.IsAny<EventId>(),
829829
It.Is<It.IsAnyType>((v, t) => v.ToString().Contains("Falling back to SBOM recorder")),
830830
It.IsAny<Exception>(),
@@ -847,7 +847,7 @@ await this.parser.ParseWithOwnershipAsync(
847847
// Verify logger warning was called
848848
this.logger.Verify(
849849
x => x.Log(
850-
LogLevel.Warning,
850+
LogLevel.Debug,
851851
It.IsAny<EventId>(),
852852
It.Is<It.IsAnyType>((v, t) => v.ToString().Contains("Falling back to SBOM recorder")),
853853
It.IsAny<Exception>(),

0 commit comments

Comments
 (0)