- 🚀 Reduces boilerplate ceremony for your
program.cs
file. - ✅ Sets up Serilog around the entire application. (:wrench: Configure all settings via your
appsettings.json
file(s)) - ✅ Simple to add some extra (helpful) log header/footer.
- ✅ Can also add logging to your
Startup
class (new with ASP.NET Core 6+)
In summary: this library makes is SIMPLE (by abstracting away most of the boring ceremony) to setup your ASP.NET Core application.
Package is available via NuGet.
dotnet add package WorldDomination.SimpleHosting
Basically, turn your program.cs
into this :
public static Task Main(string[] args)
{
return WorldDomination.SimpleHosting.Program.Main<Startup>(args);
}
and you've now got some Serilog all wired up along with some nice application-wide error handling.
For more custom settings:
public static Task Main(string[] args)
{
// Every Option here is optional.
// Set what you want.
var options = new MainOptions
{
CommandLineArguments = args,
FirstLoggingInformationMessage = "~~ Sample Web Application ~~",
LogAssemblyInformation = true,
LastLoggingInformationMessage = "-- Sample Web Application has ended/terminated --",
StartupActivation = new System.Func<WebHostBuilderContext, ILogger, Startup>((context, logger) => new Startup(context.Configuration, logger))
};
return SimpleHosting.Program.Main<Startup>(options);
}
Yep - contributions are always welcome. Please read the contribution guidelines first.
If you wish to participate in this repository then you need to abide by the code of conduct.
Yes! Please use the Issues section to provide feedback - either good or needs improvement 🆒