Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Switch to Serilog #441

Merged
merged 22 commits into from
Feb 23, 2023
Merged

feat: Switch to Serilog #441

merged 22 commits into from
Feb 23, 2023

Conversation

melotic
Copy link
Member

@melotic melotic commented Feb 21, 2023

This PR switches from our slow custom-built logging service to Serilog with Microsoft.Extensions.Loggging support. Each class gets their own injected logger unique to their type.

We also create a LoggerProviderCollection and will allow our dependents to dynamically attach other sinks such as ApplicationInsights.

New format:

image

Closes #436

Compiles, but running & tests are still broken.
This allows to optionally write events through other dynamically-added MEL `ILoggerProviders`.
…-serilog

# Conflicts:
#	src/Microsoft.ComponentDetection.Detectors/cocoapods/PodComponentDetector.cs
#	src/Microsoft.ComponentDetection.Detectors/go/GoComponentDetector.cs
#	src/Microsoft.ComponentDetection.Detectors/ivy/IvyDetector.cs
#	src/Microsoft.ComponentDetection.Detectors/maven/MavenCommandService.cs
#	src/Microsoft.ComponentDetection.Detectors/npm/NpmComponentDetector.cs
#	src/Microsoft.ComponentDetection.Detectors/nuget/NuGetComponentDetector.cs
#	src/Microsoft.ComponentDetection.Detectors/pip/PythonResolver.cs
#	src/Microsoft.ComponentDetection.Detectors/ruby/RubyComponentDetector.cs
#	src/Microsoft.ComponentDetection.Detectors/rust/RustCrateDetector.cs
#	src/Microsoft.ComponentDetection.Detectors/vcpkg/VcpkgComponentDetector.cs
#	src/Microsoft.ComponentDetection.Detectors/yarn/Parsers/YarnLockParser.cs
#	src/Microsoft.ComponentDetection.Detectors/yarn/YarnLockComponentDetector.cs
#	src/Microsoft.ComponentDetection.Orchestrator/Services/DetectorProcessingService.cs
#	src/Microsoft.ComponentDetection/Program.cs
#	test/Microsoft.ComponentDetection.Detectors.Tests/YarnLockDetectorTests.cs
#	test/Microsoft.ComponentDetection.Detectors.Tests/YarnParserTests.cs
@melotic melotic requested a review from a team as a code owner February 21, 2023 18:24
@github-actions
Copy link

github-actions bot commented Feb 21, 2023

👋 Hi! It looks like you modified some files in the Detectors folder.
You may need to bump the detector versions if any of the following scenarios apply:

  • The detector detects more or fewer components than before
  • The detector generates different parent/child graph relationships than before
  • The detector generates different devDependencies values than before

If none of the above scenarios apply, feel free to ignore this comment 🙂

@JamieMagee
Copy link
Member

I think only Microsoft.ComponentDetection should depend on Microsoft.Extensions.Logging, but all other packages should depend on Microsoft.Extensions.Logging.Abstractions.

@JamieMagee
Copy link
Member

Can you also remove ServiceBase abstract class as part of this?

Copy link
Member

@JamieMagee JamieMagee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge once all tests pass

should fix the verification tests!
The previous logger added a space after `Detection time: xx.yyyyyy seconds.  `. The new logger does not have a trailing space.
@melotic melotic merged commit 273d48e into main Feb 23, 2023
@melotic melotic deleted the justinperez/switch-to-serilog branch February 23, 2023 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to a proper logging library
3 participants