/serilog-builder

Builder log through Lapi

Primary LanguageC#MIT LicenseMIT

Build Status Codacy Badge NuGet Downloads NuGet Version Quality Gate Status Coverage

Serilog.Builder

Builder with my serilog common settings for use Console, Seq and Splunk sinks.

Sample

Suggested settings

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"
}; 

Log.Logger = builder
    .UseSuggestedSetting("MyDomain", "MyApplication")
    .SetupSeq(seqOptions)
    .SetupSplunk(splunkOptions)
    .SetupNewRelic(newRelicOptions)
    .BuildLogger();

Log.Logger.Debug("Log something");

Custom mode

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

Found something strange or need a new feature?

Open a new Issue following our issue template ISSUE_TEMPLATE

Changelog

See in nuget version history

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

1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX