yourLogger.Exceptions.Db.Ef 0.0.14

There is a newer version of this package available.
See the version list below for details.
dotnet add package yourLogger.Exceptions.Db.Ef --version 0.0.14
                    
NuGet\Install-Package yourLogger.Exceptions.Db.Ef -Version 0.0.14
                    
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="yourLogger.Exceptions.Db.Ef" Version="0.0.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="yourLogger.Exceptions.Db.Ef" Version="0.0.14" />
                    
Directory.Packages.props
<PackageReference Include="yourLogger.Exceptions.Db.Ef" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add yourLogger.Exceptions.Db.Ef --version 0.0.14
                    
#r "nuget: yourLogger.Exceptions.Db.Ef, 0.0.14"
                    
#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.
#:package yourLogger.Exceptions.Db.Ef@0.0.14
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=yourLogger.Exceptions.Db.Ef&version=0.0.14
                    
Install as a Cake Addin
#tool nuget:?package=yourLogger.Exceptions.Db.Ef&version=0.0.14
                    
Install as a Cake Tool

yourLogger Exception EF Core Logger

This is the EF Core implementation of the yourLogger Logging Library

Why?

The intention of the library was to simplify something all developers have to implement many times over their career. Logging

Logging is a very common and important task. Therefore it should be super simple to implement.

For example, with lombok annotations. All you need to start logging is use the @Sfj4 annotation on the class.

For DotNet Core, it can be as simple as passing in ILogger to the constructor thanks to the magic of dependency injection.

But it only prints to console, and we need more than that. We need to store the logs and inspect them later.

When an exception occurs, it may even be helpful to present a page to the user with a reference number.

yourLogger is a library that looks to abstract it all away. The Ef Core Logger implementation is the Ef core implementation of that abstraction.

How do I use this?

  1. Install the nuget package.

  2. Instantiate the Builder using c# DbContextOptionsBuilder Make sure the appropriate EF Core package is installed

For example, the below snippet creates a Database Option using the "ErrorDatabase" Section in AppSettings.Json

var dbOptions = new DbContextOptionsBuilder()
            .UseSqlServer(
                Configuration.GetConnectionString("ErrorDatabase"))
            .Options;
  1. Initiate a LogWriterBuilder to build the logger
var loggerBuilder = new LoggerBuilder()
            .WithConsoleLevel(LogType.Warn);
  1. Pass in the DB writer to the log builder.
loggerBuilder = loggerBuilder.WithWriter(
        loggerBuilder.BuildInDb(LogContextProvider));
  1. Build the Logger
var logger = loggerBuilder.Build(LogType.Info);

Alternatively, or more simply, we can combine steps 4 and 5 together

var logger = loggerBuilder.WithWriter(
        loggerBuilder.BuildInDb(LogContextProvider))
        .Build(LogType.Info);
  1. As the core package, use c#logger.Writer and c#logger.Reader for all your logging needs.

Customization

This library provides two different implementations:

  1. Simple DB built with BuildInDb or This logger stores each log to the DB as they come in
  2. Rolling DB built with BuildWithRolling The rolling DB implementation collects the logs in memory, and commits the entire batch to the database when there are more than > batchSize number of entries in memory.

Changing Table Name

Although most of the EF Core implementation is internal to the nuget package, it is still possible to change the table name. Create a new Context, inherit LogDbContext, and have the LogContextProvider return your new Context. And you can change the default table settings via the OnConfiguring hook.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.21 1,184 2/10/2022
0.0.20 1,104 2/10/2022
0.0.19 1,088 2/10/2022
0.0.18 1,098 2/10/2022
0.0.17 1,028 2/10/2022
0.0.16 1,094 2/10/2022
0.0.15 1,053 2/8/2022
0.0.14 976 12/2/2021

Initial Ugly release