Skip to content

Commit

Permalink
finished destination logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlsailrunner committed Feb 1, 2022
1 parent 39e3e41 commit cc1e027
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "Now listening on:\\s+(https?://\\S+)\""
"pattern": "Now listening on:\\s+(https?://\\S+)\"?"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand All @@ -36,7 +36,7 @@
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "Now listening on:\\s+(https?://\\S+)\""
"pattern": "Now listening on:\\s+(https?://\\S+)\"?"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand Down
13 changes: 13 additions & 0 deletions CarvedRock.Api/CarvedRock.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
<PackageReference Include="IdentityModel" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />

<!-- App Insights -->
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />

<!-- Serilog / Seq -->
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.1.1" />
<PackageReference Include="Serilog.Exceptions" Version="8.0.0" />

<!-- NLog / Splunk -->
<PackageReference Include="NLog" Version="4.7.13" />
<PackageReference Include="NLog.Targets.Splunk" Version="3.0.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
</ItemGroup>

<ItemGroup>
Expand Down
19 changes: 19 additions & 0 deletions CarvedRock.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,27 @@
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using Swashbuckle.AspNetCore.SwaggerGen;
using NLog;
using NLog.Web;
//using Serilog;
//using Serilog.Exceptions;

var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
// builder.Logging.AddJsonConsole();
// builder.Logging.AddDebug();
//builder.Services.AddApplicationInsightsTelemetry();

// builder.Host.UseSerilog((context, loggerConfig) => {
// loggerConfig
// .WriteTo.Console()
// .Enrich.WithExceptionDetails()
// .WriteTo.Seq("http://localhost:5341");
// });

NLog.LogManager.Setup().LoadConfigurationFromFile();
builder.Host.UseNLog();

builder.Services.AddProblemDetails(opts =>
{
opts.IncludeExceptionDetails = (ctx, ex) => false;
Expand Down
18 changes: 15 additions & 3 deletions CarvedRock.Api/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"ApplicationInsights": {
"ConnectionString": "InstrumentationKey=[REDACTED];IngestionEndpoint=https://westus2-2.in.applicationinsights.azure.com/"
},
"Logging": {
"LogLevel": {
"Default": "Information",
Expand All @@ -17,11 +20,20 @@
}
}
},
"Debug": {
"ApplicationInsights": {
"LogLevel": {
"Default": "Critical"
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"CarvedRock": "Debug"
}
}
}
// },
// "Debug": {
// "LogLevel": {
// "Default": "Critical",
// "CarvedRock": "Information"
// }
// }
},
"AllowedHosts": "*"
}
13 changes: 13 additions & 0 deletions CarvedRock.WebApp/CarvedRock.WebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.1" />

<!-- App Insights -->
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />

<!-- Serilog / Seq -->
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.1.1" />
<PackageReference Include="Serilog.Exceptions" Version="8.0.0" />

<!-- NLog / Splunk -->
<PackageReference Include="NLog" Version="4.7.13" />
<PackageReference Include="NLog.Targets.Splunk" Version="3.0.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions CarvedRock.WebApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
using System.IdentityModel.Tokens.Jwt;
using Microsoft.IdentityModel.Tokens;
using CarvedRock.WebApp;
using NLog;
using NLog.Web;
// using Serilog;
// using Serilog.Exceptions;

var builder = WebApplication.CreateBuilder(args);
builder.Logging.ClearProviders();
//builder.Logging.AddJsonConsole();
//builder.Services.AddApplicationInsightsTelemetry();

// builder.Host.UseSerilog((context, loggerConfig) => {
// loggerConfig
// .WriteTo.Console()
// .Enrich.WithExceptionDetails()
// .WriteTo.Seq("http://localhost:5341");
// });

NLog.LogManager.Setup().LoadConfigurationFromFile();
builder.Host.UseNLog();

JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
builder.Services.AddAuthentication(options =>
Expand Down
10 changes: 10 additions & 0 deletions CarvedRock.WebApp/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"ApplicationInsights": {
"ConnectionString": "InstrumentationKey=[REDACTED];IngestionEndpoint=https://westus2-2.in.applicationinsights.azure.com/"
},
"Logging": {
"LogLevel": {
"Default": "Information",
Expand All @@ -18,6 +21,13 @@
}
}
},
"ApplicationInsights": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"CarvedRock": "Debug"
}
},
"Debug": {
"LogLevel": {
"Default": "Critical"
Expand Down

0 comments on commit cc1e027

Please sign in to comment.