EvelynTSMG.EasyLogger
1.0.1
dotnet add package EvelynTSMG.EasyLogger --version 1.0.1
NuGet\Install-Package EvelynTSMG.EasyLogger -Version 1.0.1
<PackageReference Include="EvelynTSMG.EasyLogger" Version="1.0.1" />
<PackageVersion Include="EvelynTSMG.EasyLogger" Version="1.0.1" />
<PackageReference Include="EvelynTSMG.EasyLogger" />
paket add EvelynTSMG.EasyLogger --version 1.0.1
#r "nuget: EvelynTSMG.EasyLogger, 1.0.1"
#:package EvelynTSMG.EasyLogger@1.0.1
#addin nuget:?package=EvelynTSMG.EasyLogger&version=1.0.1
#tool nuget:?package=EvelynTSMG.EasyLogger&version=1.0.1
What is EasyLogger?
EasyLogger is a C# logging library intended to be simple and easy to use.
It is NOT intended to:
- have every feature under the sun,
- maintain backwards compatibility across many versions of C#,
- be the end all be all of C# logger libraries.
How to use EasyLogger?
Loggers need a LoggerConfig, as well as any amount of ILogWriters.
For documentation on the configuration,
see EasyLogger/LoggerConfig.cs
For example, you can create a new Logger to write to the console with the default configuration like so:
Logger logger = new(new LoggerConfig(), new ConsoleLogWriter());
If you want to create multiple log files with the same configuration, a FileLoggerFactory is provided.
The factory will automatically add a FileLogWriter to created loggers.
Additional writers may be passed in the factory constructor.
They will be directly used by created loggers, no copies will be made.
All loggers created by the factory will log to the logDirectory provided to the factory.
FileLoggerFactory loggerFactory = new("./logs/", new LoggerConfig(), new ConsoleLogWriter());
Logger appleLogger = loggerFactory.Create("apple");
Logger bananaLogger = loggerFactory.Create("banana");
Logger cherryLogger = loggerFactory.Create("cherry");
Remember to flush or close loggers before the application exits.
Otherwise, there is no guarantee the loggers will properly flush.
Once you have a Logger, logging can be performed using the Log method.
You must pass in the log level and message, like so:
appleLogger.Log(LogLevel.Info, "I like apples.");
Shorthand methods are provided for logging each supported level:
appleLogger.Trace("Talking about shorthand methods.");
appleLogger.Debug("I do not want bugs in my food.");
appleLogger.Verbose("I like green apples because they are sour.")
appleLogger.Info("I like apples.");
appleLogger.Warn("I do not like bananas.");
appleLogger.Error("Tomatoes are a berry.");
appleLogger.Fatal("I'm allergic to peanuts.");
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- JetBrains.Annotations (>= 2025.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
README fix