SimpLog 2.1.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package SimpLog --version 2.1.1                
NuGet\Install-Package SimpLog -Version 2.1.1                
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="SimpLog" Version="2.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpLog --version 2.1.1                
#r "nuget: SimpLog, 2.1.1"                
#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 SimpLog as a Cake Addin
#addin nuget:?package=SimpLog&version=2.1.1

// Install SimpLog as a Cake Tool
#tool nuget:?package=SimpLog&version=2.1.1                

SimpLog NuGet Package

Simple NuGet package to write log files when you need.

Statuses

  1. Trace → This should be used during development to track bugs, but never committed to your VCS.
  2. Debug → log at this level about anything that happens in the program. This is mostly used during debugging, and I’d advocate trimming down the number of debug statement before entering the production stage, so that only the most meaningful entries are left, and can be activated during troubleshooting.
  3. Info → Log at this level all actions that are user-driven, or system specific (ie regularly scheduled operations…)
  4. Notice → This will certainly be the level at which the program will run when in production. Log at this level all the notable events that are not considered an error.
  5. Warn → Log at this level all events that could potentially become an error. For instance if one database call took more than a predefined time, or if an in-memory cache is near capacity. This will allow proper automated alerting, and during troubleshooting will allow to better understand how the system was behaving before the failure.
  6. Error → Log every error condition at this level. That can be API calls that return errors or internal error conditions.
  7. Fatal → Too bad, it’s doomsday. Use this very scarcely, this shouldn’t happen a lot in a real program. Usually logging at this level signifies the end of the program. For instance, if a network daemon can’t bind a network socket, log at this level and exit is the only sensible thing to do.

Configuration in Program.cs

builder.Services.SimpLog();

Configuration in Controller

private readonly ISimpLog _simpLog;

public HomeController( ISimpLog simpLog) { _simpLog = simpLog; }

Use it in Action method

_simpLog.Info("Your message here!", {1}, {2}, {3}, {4}); → This is direct saving and there is no way of loosing data.

{1} → type of recording. Buffer is faster but there can be a little data loss. Standart is directly saving into the log file. {2} → do you want to send email.

{3} and {4} are optional if {1} and {2} are not null!

{3} → path of the log file {4} → name of the log file

If you did not set file name and path then the library won't work. If you set both, the file path and name will be {3} and {4}.

Hope you enjoy the NuGet Package! 😃

appsettings.json example structure for configuring the SimpLog library<br /> "SimpLog": {<br /> "PathToSaveLogs": "<your path here>",<br /> "LogFileName": "<log file name>",<br /> "LogType": {<br /> "Trace": {<br /> "Log": true,<br /> "SendEmail": true,<br /> "SaveInDatabase": true<br /> },<br /> "Debug": {<br /> "Log": true,<br /> "SendEmail": true,<br /> "SaveInDatabase": true<br /> },<br /> "Info": {<br /> "Log": true,<br /> "SendEmail": true,<br /> "SaveInDatabase": true<br /> },<br /> "Notice": {<br /> "Log": true,<br /> "SendEmail": true,<br /> "SaveInDatabase": true<br /> },<br /> "Warn": {<br /> "Log": true,<br /> "SendEmail": true,<br /> "SaveInDatabase": true<br /> },<br /> "Error": {<br /> "Log": true,<br /> "SendEmail": true,<br /> "SaveInDatabase": true<br /> },<br /> "Fatal": {<br /> "Log": true,<br /> "SendEmail": true,<br /> "SaveInDatabase": true<br /> }<br /> },<br /> "Email_Configuration": {<br /> "SendEmail_Globally": "<disable or enable globally emails>"<br /> "Email_From": "<sender email>",<br /> "Email_To": "<receiver email>",<br /> "Email_BCC": "<blind copy email>",<br /> "Email_Connection": {<br /> "Host": "<host>",<br /> "Port": "<port of the host>",<br /> "API_Key": "<api key>",<br /> "API_Value": "<api value>"<br /> },<br /> "Database_Configuration": {<br /> "Connection_String": "<connection string of the desired database>",<br /> "Global_Database_Type": "<type of db>", // MSSql or MySql. N.B! Be carefull with spelling!<br /> "DateTime_Format": "", // still not working<br /> "Global_Enabled_Save": false,<br /> "Activate_Migration": false // still not implemented<br /> }<br /> }<br />

Product 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.

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
2.2.6 124 4/21/2024
2.2.5 167 3/20/2024
2.2.4 640 11/22/2023
2.2.3 535 10/23/2023
2.2.2 530 10/17/2023
2.2.1 580 9/30/2023
2.2.0 505 9/15/2023
2.1.2 537 8/22/2023
2.1.1 532 7/13/2023
1.1.2 524 6/11/2023
1.1.1 550 3/6/2023
1.1.0 640 3/1/2023
1.0.0 639 1/14/2023
0.0.1-alpha 571 3/29/2022

- save in MSSQL or in MySQL databases logs and what email has been sent