Extensions.Logging.ListOfString : Test your logging with new StringListLogger().Log(...) NuGet Package

Extensions.Logging.ListOfString logs to a list of string so you can test your logging :
```
ILoggerFactory factory=new LoggerFactory.AddProvider(new StringListLoggerProvider())
ILogger logger= factory.CreateLogger("Test1");

...tests..

;

StringListLogger.Instance
.LoggedLines
.ShouldContain(x=>x.Matches("kilroy was here"));
```
or
```
var loggedLines = new List<string>();
var logger= new LoggerFactory().AddStringListLogger(loggedLines).CreateLogger("Test2");

...tests..;

loggedLines .ShouldContain(x=>x.Matches("kilroy was here too."));

```

This is for Microsoft.Extensions.Logging.Abstractions.

For Serilog, see https://www.nuget.org/packages/Serilog.Sinks.ListOfString/

Part of https://www.nuget.org/packages/TestBase

*TestBase* gives you a flying start to unit testing with fluent assertions that are easy to extend, and
tools for testing with dependencies on AspNetMvc, HttpClient, Ado.Net, Streams and Loggers.




Got any Extensions.Logging.ListOfString : Test your logging with new StringListLogger().Log(...) Question?





Info

Version: 4.1.2.5
Author(s): Chris F Carroll
Last Update: Tuesday, October 23, 2018
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/chrisfcarroll/TestBase
NuGet Url: https://www.nuget.org/packages/Extensions.Logging.ListOfString


Install
Install-Package Extensions.Logging.ListOfString
dotnet add package Extensions.Logging.ListOfString
paket add Extensions.Logging.ListOfString
Extensions.Logging.ListOfString Download (Unzip the "nupkg" after downloading)



Tags



STATS

must-have-score

.3

avg-downloads-per-day

1

days-since-last-release

2221