https://github.com/thiagobarradas/serilog-builder
Builder for my common log format for dotnet, using console, seq and splunk, besides other configs.
https://github.com/thiagobarradas/serilog-builder
builder console dotnet-core dotnet-standard environment environment-variables seq serilog splunk
Last synced: 3 months ago
JSON representation
Builder for my common log format for dotnet, using console, seq and splunk, besides other configs.
- Host: GitHub
- URL: https://github.com/thiagobarradas/serilog-builder
- Owner: ThiagoBarradas
- License: mit
- Created: 2018-09-13T17:00:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-06T15:31:48.000Z (over 1 year ago)
- Last Synced: 2025-03-23T20:05:33.323Z (4 months ago)
- Topics: builder, console, dotnet-core, dotnet-standard, environment, environment-variables, seq, serilog, splunk
- Language: C#
- Size: 107 KB
- Stars: 6
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://barradas.visualstudio.com/Contributions/_build/latest?definitionId=9&branchName=master)
[](https://www.codacy.com/app/ThiagoBarradas/serilog-builder?utm_source=github.com&utm_medium=referral&utm_content=ThiagoBarradas/serilog-builder&utm_campaign=Badge_Grade)
[](https://www.nuget.org/packages/Serilog.Builder/)
[](https://www.nuget.org/packages/Serilog.Builder/)
[](https://sonarcloud.io/dashboard?id=ThiagoBarradas_serilog-builder)
[](https://sonarcloud.io/dashboard?id=ThiagoBarradas_serilog-builder)# Serilog.Builder
Builder with my serilog common settings for use Console, Seq and Splunk sinks.
# Sample
Suggested settings
```c#LoggerBuilder builder = new LoggerBuilder();
SeqOptions seqOptions = new SeqOptions
{
Enabled = true,
Url = "http://localhost",
ApiKey = "123456"
};SplunkOptions splunkOptions = new SplunkOptions
{
Enabled = true,
Url = "http://localhost",
Token = "123456",
Index = "my.index"
};NewRelicOptions newRelicOptions = new NewRelicOptions
{
Enabled = true,
AppName = "My App",
LicenseKey = "xxxxx"
};DataDogOptions dataDogOptions = new DataDogOptions
{
Enabled = true,
Service = "My App",
ApiKey = "xxxxx"
};Log.Logger = builder
.UseSuggestedSetting("MyDomain", "MyApplication")
.SetupSeq(seqOptions)
.SetupSplunk(splunkOptions)
.SetupNewRelic(newRelicOptions)
.SetupDataDog(dataDogOptions)
.BuildLogger();Log.Logger.Debug("Log something");
```
Custom mode
```c#LoggerBuilder builder = new LoggerBuilder();
Log.Logger = builder
.EnableConsole()
.EnableSeq("http://localhost")
.EnableSplunk("http://localhost")
.EnableNewRelic("My App")
.EnableEnrichWithEnvironment()
.AddEnrichProperty("Application", "MyApp")
.SetMinimumLevel(LogEventLevel.Debug)
.AddOverrideMinimumLevel("System", LogEventLevel.Error)
.BuildLogger();Log.Logger.Debug("Log something");
```
## Install via NuGet
```
PM> Install-Package Serilog.Builder
```## How can I contribute?
Please, refer to [CONTRIBUTING](.github/CONTRIBUTING.md)## Found something strange or need a new feature?
Open a new Issue following our issue template [ISSUE_TEMPLATE](.github/ISSUE_TEMPLATE.md)## Changelog
See in [nuget version history](https://www.nuget.org/packages/Serilog.Builder)## Did you like it? Please, make a donate :)
If you liked this project, please make a contribution and help to keep this and other initiatives, send me some Satochis.
BTC Wallet: `1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX`
