-
-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (27 loc) · 1.25 KB
/
Program.cs
File metadata and controls
37 lines (27 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Exceptionless;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
var builder = WebApplication.CreateBuilder(args);
// By default sends warning and error log messages to Exceptionless.
// Log levels can be controlled remotely per log source from the Exceptionless app in near real-time.
builder.Logging.AddExceptionless();
// Reads settings from IConfiguration then adds additional configuration from this lambda.
// This also configures ExceptionlessClient.Default and host shutdown queue flushing.
builder.AddExceptionless(c => c.DefaultData["Startup"] = "heyyy");
// OR
// builder.AddExceptionless();
// OR
// builder.AddExceptionless("API_KEY_HERE");
// Adds ASP.NET Core request/unhandled exception hooks and standard exception handling services.
builder.Services.AddExceptionless();
builder.Services.AddProblemDetails();
// This is normal ASP.NET Core code.
builder.Services.AddControllers();
var app = builder.Build();
// Uses the built-in exception handler pipeline, with Exceptionless capturing via IExceptionHandler.
app.UseExceptionHandler();
// Adds Exceptionless middleware for diagnostics, 404 tracking, and queue processing.
app.UseExceptionless();
app.MapControllers();
app.Run();