f919d6b25b
- Wrap using directives in `#region` blocks across the Battery, Boiler and NordPool sources and tests - Expand single-statement guards and loops into braced blocks - Realign wrapped method arguments, chained calls and continuations - Replace target-typed `new()` with explicit generic construction and empty string literals with `string.Empty` - Flatten the boiler config expression and reindent the remaining touched files
28 lines
815 B
C#
28 lines
815 B
C#
#region
|
|
|
|
using System;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Serilog;
|
|
|
|
#endregion
|
|
|
|
namespace HomeAssistantServer;
|
|
|
|
public static class CustomLoggingProvider
|
|
{
|
|
public static IHostBuilder UseCustomLogging(this IHostBuilder builder)
|
|
{
|
|
var configuration = new ConfigurationBuilder()
|
|
.AddJsonFile("appsettings.json")
|
|
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT") ?? "Production"}.json",
|
|
true)
|
|
.Build();
|
|
|
|
var logger = new LoggerConfiguration()
|
|
.ReadFrom.Configuration(configuration)
|
|
.CreateLogger();
|
|
|
|
return builder.UseSerilog(logger);
|
|
}
|
|
} |