generated from dailydevops/dotnet-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Created Solution File * chore: Created projects * fix: Renamed project typo * chore: Initial implementation * chore: Extended implementation * chore: Added first tests * chore: Activated SonarQube * chore: Updated `.gitmodules` [skip ci] * chore: Finished implementation, added tests * fix: Removed timestamp * fix: Removed `.AutoVerify` * fix: Removed unused prefix * fix: Solution reference * fix: Removed unused solution references * fix: Verify files
- Loading branch information
Showing
37 changed files
with
1,815 additions
and
90 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,9 @@ jobs: | |
name: Build & Tests | ||
uses: dailydevops/pipelines/.github/workflows/[email protected] | ||
with: | ||
disablePublish: true | ||
enableSonarQube: true | ||
dotnet-logging: ${{ inputs.dotnet-logging }} | ||
dotnet-version: | | ||
8.x | ||
solution: ###SOLUTION### | ||
solution: ./Logging.XUnit.sln | ||
secrets: inherit |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[submodule "eng"] | ||
path = eng | ||
url = https://github.com/dailydevops/dotnet-engineering.git | ||
update = merge | ||
update = rebase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<GlobalPackageReference Include="CSharpier.MSBuild" Version="0.26.3" /> | ||
<GlobalPackageReference Include="CSharpier.MSBuild" Version="0.28.2" /> | ||
<GlobalPackageReference Include="GitVersion.MsBuild" Version="5.12.0" /> | ||
<GlobalPackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" /> | ||
<GlobalPackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" /> | ||
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" /> | ||
<GlobalPackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.8.14" /> | ||
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="9.16.0.82469" Condition=" '$(BuildingInsideVisualStudio)' == 'true' " /> | ||
<GlobalPackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.10.48" /> | ||
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="9.25.0.90414" Condition=" '$(BuildingInsideVisualStudio)' == 'true' " /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
<ItemGroup> | ||
<PackageVersion Include="coverlet.collector" Version="6.0.2" /> | ||
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" /> | ||
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="8.0.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" /> | ||
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" /> | ||
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.5.0" /> | ||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" /> | ||
<PackageVersion Include="NetEvolve.Arguments" Version="1.2.0" /> | ||
<PackageVersion Include="NetEvolve.Logging.Abstractions" Version="1.1.0" /> | ||
<PackageVersion Include="Verify.Xunit" Version="24.2.0" /> | ||
<PackageVersion Include="xunit" Version="2.8.0" /> | ||
<PackageVersion Include="xunit.extensibility.core" Version="2.8.0" /> | ||
<PackageVersion Include="xunit.extensibility.execution" Version="2.8.0" /> | ||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.0" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D9954CB8-DB50-4331-A461-36A4AD4DA06E}" | ||
ProjectSection(SolutionItems) = preProject | ||
.editorconfig = .editorconfig | ||
.filenesting.json = .filenesting.json | ||
.gitattributes = .gitattributes | ||
.gitignore = .gitignore | ||
.gitmodules = .gitmodules | ||
Directory.Build.props = Directory.Build.props | ||
Directory.Build.targets = Directory.Build.targets | ||
Directory.Packages.props = Directory.Packages.props | ||
Directory.Solution.props = Directory.Solution.props | ||
GitVersion.yml = GitVersion.yml | ||
LICENSE = LICENSE | ||
new-project.ps1 = new-project.ps1 | ||
nuget.config = nuget.config | ||
README.md = README.md | ||
update-solution.ps1 = update-solution.ps1 | ||
EndProjectSection | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EFE8181B-6FAB-4E04-BD9B-557C1286B858}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{BD750CCE-0318-424D-89B4-9C66EF329E96}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetEvolve.Logging.XUnit", "src\NetEvolve.Logging.XUnit\NetEvolve.Logging.XUnit.csproj", "{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetEvolve.Logging.XUnit.Tests.Unit", "tests\NetEvolve.Logging.XUnit.Tests.Unit\NetEvolve.Logging.XUnit.Tests.Unit.csproj", "{EAAD2C22-48F4-4E37-9A46-0350C6B84388}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetEvolve.Logging.XUnit.Tests.Integration", "tests\NetEvolve.Logging.XUnit.Tests.Integration\NetEvolve.Logging.XUnit.Tests.Integration.csproj", "{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF} = {EFE8181B-6FAB-4E04-BD9B-557C1286B858} | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388} = {BD750CCE-0318-424D-89B4-9C66EF329E96} | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12} = {BD750CCE-0318-424D-89B4-9C66EF329E96} | ||
EndGlobalSection | ||
EndGlobal | ||
CPU.Build.0 = Release|Any CPU | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{3F3CD6EC-4636-4B58-8400-09AC2B9BAFDF} = {EFE8181B-6FAB-4E04-BD9B-557C1286B858} | ||
{EAAD2C22-48F4-4E37-9A46-0350C6B84388} = {BD750CCE-0318-424D-89B4-9C66EF329E96} | ||
{F2B38EDD-63F9-4027-9EA6-D1E0C6387C12} = {BD750CCE-0318-424D-89B4-9C66EF329E96} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# template-dotnet | ||
.NET template for repositories | ||
# NetEvolve.Logging.XUnit | ||
|
||
This library provides a logging implementation for [XUnit](https://xunit.net/). When using this library, you have the ability to access the logs generated while executing your tests. This can be useful for debugging purposes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace NetEvolve.Logging.XUnit; | ||
|
||
/// <summary> | ||
/// Accessor for the options of the <see cref="XUnitLogger"/>. | ||
/// </summary> | ||
public interface IXUnitLoggerOptions | ||
{ | ||
/// <summary> | ||
/// Disables the output of the additional information in the log output. Default <see langword="false"/>. | ||
/// </summary> | ||
bool DisableAdditionalInformation { get; } | ||
|
||
/// <summary> | ||
/// Disable the log level in the log output. Default <see langword="false"/>. | ||
/// </summary> | ||
bool DisableLogLevel { get; } | ||
|
||
/// <summary> | ||
/// Disable the scopes in the log output. Default <see langword="false"/>. | ||
/// </summary> | ||
bool DisableScopes { get; } | ||
|
||
/// <summary> | ||
/// Disables the timestamps in the log output. Default <see langword="false"/>. | ||
/// </summary> | ||
bool DisableTimestamp { get; } | ||
|
||
/// <summary> | ||
/// The format of the timestamp in the log output. Default <c>"o"</c>. | ||
/// </summary> | ||
string TimestampFormat { get; } | ||
} |
27 changes: 27 additions & 0 deletions
27
src/NetEvolve.Logging.XUnit/NetEvolve.Logging.XUnit.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(ProjectTargetFrameworks)</TargetFrameworks> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Package settings"> | ||
<Title>$(MSBuildProjectName)</Title> | ||
<Description>Extensions for `ILogger` implementations to log messages to xUnit test output.</Description> | ||
<RepositoryUrl>https://github.com/dailydevops/logging.xunit.git</RepositoryUrl> | ||
<PackageProjectUrl>https://github.com/dailydevops/logging.xunit.git</PackageProjectUrl> | ||
<PackageTags>logging;provider;xunit</PackageTags> | ||
<CopyrightYearStart>2024</CopyrightYearStart> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Bcl.TimeProvider" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" /> | ||
<PackageReference Include="NetEvolve.Arguments" /> | ||
<PackageReference Include="NetEvolve.Logging.Abstractions" /> | ||
<PackageReference Include="xunit.extensibility.core" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# NetEvolve.Logging.XUnit | ||
|
||
This library provides a logging implementation for [XUnit](https://xunit.net/). When using this library, you have the ability to access the logs generated while executing your tests. This can be useful for debugging purposes. | ||
|
||
## Installation | ||
```bash | ||
dotnet add package NetEvolve.Logging.XUnit | ||
``` | ||
|
||
## Usage | ||
|
||
You can choose to use the `XUnitLogger` class directly or use the `AddXUnit` extension method on the `ILoggingBuilder` instance. | ||
|
||
### Direct usage | ||
|
||
```csharp | ||
using Microsoft.Extensions.Logging; | ||
using NetEvolve.Logging.XUnit; | ||
using XUnit; | ||
|
||
public class ExampleTests | ||
{ | ||
private readonly ITestOutputHelper _output; | ||
|
||
public ExampleTests(ITestOutputHelper output) | ||
{ | ||
_output = output; | ||
} | ||
|
||
[Fact] | ||
public void Test() | ||
{ | ||
var logger = XUnitLogger.CreateLogger<ExampleTests>(_output); | ||
|
||
// Arrange | ||
... | ||
// Act | ||
... | ||
// Assert | ||
... | ||
|
||
Assert.NotEmpty(logger.LoggedMessages); | ||
} | ||
} | ||
``` | ||
|
||
### Usage with `ILoggingBuilder.AddXUnit` | ||
|
||
Or you can use the `AddXUnit` extension method on the `ILoggingBuilder` instance. | ||
|
||
```csharp | ||
using Microsoft.Extensions.Logging; | ||
using NetEvolve.Logging.XUnit; | ||
|
||
var services = new ServiceCollection(); | ||
services.AddLogging(builder => | ||
{ | ||
// Add the XUnit logging implementation | ||
builder.AddXUnit(); | ||
|
||
// Or alternatively with options | ||
builder.AddXUnit(options => | ||
{ | ||
options.TimestampFormat = "HH:mm:ss.fff"; | ||
}); | ||
}); | ||
``` |
Oops, something went wrong.