Test4Net.Logging
2022.11.5.2
dotnet add package Test4Net.Logging --version 2022.11.5.2
NuGet\Install-Package Test4Net.Logging -Version 2022.11.5.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Test4Net.Logging" Version="2022.11.5.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Test4Net.Logging --version 2022.11.5.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Test4Net.Logging, 2022.11.5.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Test4Net.Logging as a Cake Addin #addin nuget:?package=Test4Net.Logging&version=2022.11.5.2 // Install Test4Net.Logging as a Cake Tool #tool nuget:?package=Test4Net.Logging&version=2022.11.5.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Test4Net.Logging
Introduction
Net core logger. Can incorporate log4net with log4net aspNetCore extension.
Examples
Simple logger
var log = LogProvider._GetLogger<Program>();
log.Info("Info message !!!", 1, 2, 3);
log.Warn("Warn message !!!", 1, 2, 3);
log.Debug("Debug message !!!", 1, 2, 3);
log.Error(new ArgumentException(".......No arguments!!"), "Error message !!!", 1, 2, 3);
Decorating logger with configuration
var log = LogProvider._GetLogger<Program>(builder => builder.Decorate(TestConfiguration.GetSection("Logging")))
where json format is:
{
"Logging": {
"LogLevel": { // All providers, LogLevel applies to all the enabled providers.
"Default": "Error", // Default logging, Error and higher.
"Microsoft": "Warning" // All Microsoft* categories, Warning and higher.
},
"Debug": { // Debug provider.
"LogLevel": {
"Default": "Information", // Overrides preceding LogLevel:Default setting.
"Microsoft.Hosting": "Trace" // Debug:Microsoft.Hosting category.
}
},
"EventSource": { // EventSource provider
"LogLevel": {
"Default": "Warning" // All categories of EventSource provider.
}
}
}
}
More about log formatter Creating logger using dependency injection
// Define loggers
var loggerTypes = new[]
{ typeof(LogAdapter<TargetClassA>), typeof(LogAdapter<TargetClassB>) };
// Call constructor, decorate optional
var logProvider = new LogProvider(loggerTypes,
builder => builder.Decorate(TestConfiguration.GetSection("Logging")));
// Call loggers
var classAlogger = logProvider.GetLogger<TargetClass1>()
var classBlogger = logProvider.GetLogger<TargetClass1>()
Integrating log4net using log4Net-aspNetCore nuget
var logger = LogProvider._GetLogger<LogProviderTest>(builder =>
builder.Decorate(TestConfiguration.GetSection("Logging"))
.AddLog4Net("log4net.config"));
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Configuration (>= 6.0.0)
- Microsoft.Extensions.Logging.Console (>= 6.0.0)
- Microsoft.Extensions.Logging.Debug (>= 6.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Test4Net.Logging:
Package | Downloads |
---|---|
Test4Net.Util
Net core logger. Can incorporate log4net with log4net aspNetCore extension. |
|
Test4Net.Test
Base model for automated test implementation |
|
Test4Net.UI.POM
Page Object Model for test automation |
|
Test4Net.UI.WebBrowser
Selenium web driver adapter. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2022.11.5.2 | 1,350 | 11/5/2022 |
2022.11.4.1 | 802 | 11/4/2022 |
2022.11.3.1 | 820 | 11/3/2022 |
2022.11.2.2 | 823 | 11/2/2022 |
2022.11.1.14 | 801 | 11/1/2022 |
2022.11.1.8 | 679 | 11/1/2022 |
2022.11.1.1 | 527 | 11/1/2022 |
2022.10.28.5 | 573 | 10/28/2022 |