Created
October 26, 2020 06:43
-
-
Save ridomin/1901b95ce056c539afc23f22d51fd34a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Logging": { | |
"Console": { | |
"LogLevel": { | |
"Default": "Warning" | |
} | |
}, | |
"Debug": { | |
"LogLevel": { | |
"Default": "Trace" | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.Logging; | |
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace TemperatureController2 | |
{ | |
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
var cancellationTokenSource = new CancellationTokenSource(); | |
IConfiguration config = new ConfigurationBuilder() | |
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) | |
.AddEnvironmentVariables() | |
.AddCommandLine(args) | |
.Build(); | |
ILogger logger = LoggerFactory.Create(builder => | |
builder | |
.AddConfiguration(config.GetSection("Logging")) | |
.AddDebug() | |
.AddConsole() | |
).CreateLogger<Program>(); | |
logger.LogInformation("Starting .... "); | |
await new Device(config, logger).Run(cancellationTokenSource.Token); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment