https://github.com/j0nimost/entrylog.extensions.logging
Utilizes Microsoft.Extensions.Logging Library to create a seamless File Logger
https://github.com/j0nimost/entrylog.extensions.logging
extensions logging
Last synced: 8 months ago
JSON representation
Utilizes Microsoft.Extensions.Logging Library to create a seamless File Logger
- Host: GitHub
- URL: https://github.com/j0nimost/entrylog.extensions.logging
- Owner: j0nimost
- License: mit
- Created: 2021-08-13T18:19:08.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-15T16:22:10.000Z (almost 5 years ago)
- Last Synced: 2025-03-15T08:34:26.580Z (over 1 year ago)
- Topics: extensions, logging
- Language: C#
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## EntryLog.Extensions.Logging
An Extension Library for `Microsoft.Extensions.Logging` using the default implementation of [EntryLog Lib](https://github.com/j0nimost/EntryLog). \
Download the latest version using `Install-Package EntryLog.Extensions.Logging`. \
Else choose a specific version [here](https://www.nuget.org/packages/EntryLog.Extensions.Logging)
### Implementation
The library comes in handy when writing logs from the robust `ILogger` library.
- Implementation is done in the `Program.cs` like so:
```c#
static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(builder =>
builder.AddEntryLog(config =>
{
config.FolderPath = new Uri(@"C:\logTests\entrlogExtension");
config.LogInterval = LogInterval.EveryMinute;
}));
```
- To remove default logging extensions i.e Console use `builder.ClearProviders()`. \
So the implementation changes to:
```c#
Host.CreateDefaultBuilder(args)
.ConfigureLogging(builder =>
builder.ClearProviders().AddEntryLog()
```
### DefaultS
There are 2 default values set:
- Logging Folder Path : Directory Where the service is running
- Logging Interval : Every hour
#### Note:
The DEFAULT values can be changed as shown in the implementation. \
There are 3 logging levels supported:
- LogInformation
- LogWarning
- LogError
### .Net Support
2.1, 2.2, 3.0, 3.1, 5.0
### Author
John Nyingi
### Contributions
Feel Free to Hack