Skip to content

Commit

Permalink
Merge e173705 into 8fee408
Browse files Browse the repository at this point in the history
  • Loading branch information
helto4real committed Apr 11, 2020
2 parents 8fee408 + e173705 commit 4c1aa40
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The following environment variables are available to identify your Home Assistan

Example giving:
```
docker run -d \
docker run -dt \
--name netdaemon \
--restart=always \
-e HASS_HOST=192.168.1.1 \
Expand Down
29 changes: 17 additions & 12 deletions src/Service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,31 @@ public static async Task Main(string[] args)
.MinimumLevel.Is(Program.LogLevel)
.WriteTo.Console(theme: AnsiConsoleTheme.Code)
.CreateLogger();

CreateHostBuilder(args).Build().Run();
}
catch (Exception e)
{
Log.Fatal(e, "Home assistant add-on config not valid json, ending add-on...");
return;
}

CreateHostBuilder(args).Build().Run();
finally
{
Log.CloseAndFlush();
}
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(services => { services.AddHostedService<RunnerService>(); })
.ConfigureLogging(logging =>
{
logging.ClearProviders();
// logging.AddConsole(options => options.IncludeScopes = false);
// logging.AddDebug();
// logging.AddFilter("Microsoft", LogLevel.Error);
logging.AddSerilog();
});
.UseSerilog()
.ConfigureServices(services => { services.AddHostedService<RunnerService>(); });
// .ConfigureLogging(logging =>
// {
// logging.ClearProviders();
// // logging.AddConsole(options => options.IncludeScopes = false);
// // logging.AddDebug();
// // logging.AddFilter("Microsoft", LogLevel.Error);
// logging.AddSerilog();
// }
// );
}
}

0 comments on commit 4c1aa40

Please sign in to comment.