Fs.Core.SimpleLogger
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Fs.Core.SimpleLogger --version 1.0.0
NuGet\Install-Package Fs.Core.SimpleLogger -Version 1.0.0
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="Fs.Core.SimpleLogger" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fs.Core.SimpleLogger" Version="1.0.0" />
<PackageReference Include="Fs.Core.SimpleLogger" />
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 Fs.Core.SimpleLogger --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Fs.Core.SimpleLogger, 1.0.0"
#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 Fs.Core.SimpleLogger@1.0.0
#: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=Fs.Core.SimpleLogger&version=1.0.0
#tool nuget:?package=Fs.Core.SimpleLogger&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Simple Logger C#.NET
仓库定位:
- 无依赖第三方dll; 建议在需要"纯洁"的场景中使用;如非高频的基础类库, 程序加载器
- 未进行性能测试; 建议性能敏感领域使用商业库, 如Nlog或Serilog等 ------2023-09-13 (星期三) byZcb
Ref: Github
=============
- 详情参考Githubu上的介绍; 本仓库在原基础的代码进行删减,并去掉了Sample项目
https://github.com/jirkapenzes/SimpleLogger
Very easy to use.
Usage
public static void Main()
{
// Adding handler - to show log messages (ILoggerHandler)
Logger.LoggerHandlerManager
.AddHandler(new ConsoleLoggerHandler())
.AddHandler(new FileLoggerHandler())
.AddHandler(new DebugConsoleLoggerHandler());
// Fast logging (monitor name of class and methods from which is the application logged)
Logger.Log();
// We define a log message
Logger.Log("Hello world");
// We can define the level (type) of message
Logger.Log(Logger.Level.Fine, "Explicit define level");
// Explicit definition of the class from which the logging
Logger.Log<Program>("Explicit define log class");
Logger.Log<Program>(Logger.Level.Fine, "Explicit define log class and level");
// Settings of default type of message
Logger.DefaultLevel = Logger.Level.Severe;
try
{
// Simulation of exceptions
throw new Exception();
}
catch (Exception exception)
{
// Logging exceptions
// Automatical adjustment of specific log into the Error and adding of StackTrace
Logger.Log(exception);
Logger.Log<Program>(exception);
}
// Special feature - debug logging
Logger.Debug.Log("Debug log");
Logger.Debug.Log<Program>("Debug log");
Logger.DebugOff();
Logger.Debug.Log("Not-logged message");
Logger.DebugOn();
Logger.Debug.Log("I'am back!");
Console.ReadKey();
}
Output
12.10.2012 21:43: Info [line: 18 Program -> Main()]: There is no message
12.10.2012 21:43: Info [line: 21 Program -> Main()]: Hello world
12.10.2012 21:43: Fine [line: 24 Program -> Main()]: Explicit define level
12.10.2012 21:43: Info [line: 27 Program -> Main()]: Explicit define log class
12.10.2012 21:43: Fine [line: 28 Program -> Main()]: Explicit define log class and level
12.10.2012 21:43: Error [line: 35 Program -> Main()]: Exception of type 'System.Exception' was thrown.
12.10.2012 21:43: Error [line: 35 Program -> Main()]: Log exception -> Message: Exception of type 'System.Exception' was thrown.
StackTrace: at SimpleLogger.Sample.Program.Main() in c:\GitHub\SimpleLogger\SimpleLogger.Sample\Program.cs:line 35
12.10.2012 21:43: Debug [line: 47 Program -> Main()]: Debug log
12.10.2012 21:43: Debug [line: 48 Program -> Main()]: Debug log
12.10.2012 21:43: Debug [line: 55 Program -> Main()]: I'am back!
Modules
Email module
// Email module sample
public static void EmaiLModuleSample()
{
// Configuring smtp server
var smtpServerConfiguration = new SmtpServerConfiguration("userName", "password", "smtp.gmail.com", 587);
// Creating a module
var emailSenderLoggerModule = new EmailSenderLoggerModule(smtpServerConfiguration)
{
EnableSsl = true,
Sender = "sender-email@gmail.com"
};
// Adding recipients
emailSenderLoggerModule.Recipients.Add("recipients@gmail.com");
// Add the module and it works
Logger.Modules.Install(emailSenderLoggerModule);
try
{
// Simulation of exceptions
throw new NullReferenceException();
}
catch (Exception exception)
{
// Log exception
// If you catch an exception error -> will be sent an email with a list of log message.
Logger.Log(exception);
}
}
MS SQL database module
// MS SQL database module sample
public static void MsSqlDatabaseLoggerModuleSample()
{
var connectionString = "Your connection string";
// Just add the module and it works!
Logger.Modules.Install(new MsSqlDatabaseLoggerModule(connectionString));
Logger.Log("My first database log! ");
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. 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.
-
.NETStandard 2.0
- No dependencies.
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 |
|---|---|---|
| 1.1.6 | 99 | 4/24/2026 |
| 1.1.5 | 89 | 4/23/2026 |
| 1.1.4 | 110 | 4/17/2026 |
| 1.1.3 | 88 | 4/17/2026 |
| 1.1.2 | 92 | 4/17/2026 |
| 1.1.1 | 85 | 4/16/2026 |
| 1.1.0 | 91 | 4/16/2026 |
| 1.0.9 | 92 | 4/16/2026 |
| 1.0.8 | 86 | 4/16/2026 |
| 1.0.7 | 87 | 4/16/2026 |
| 1.0.6 | 86 | 4/16/2026 |
| 1.0.5 | 88 | 4/16/2026 |
| 1.0.4 | 173 | 3/9/2026 |
| 1.0.3 | 474 | 12/5/2025 |
| 1.0.2 | 230 | 12/5/2025 |
| 1.0.1 | 187 | 10/24/2025 |
| 1.0.0 | 224 | 10/21/2025 |
| 0.0.9 | 210 | 10/21/2025 |
| 0.0.8 | 217 | 10/21/2025 |