Skip to content

Commit e9ac4d9

Browse files
committed
Add Profiling
1 parent 3ff2a7d commit e9ac4d9

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

MyApp/_pages/admin-ui-features.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,16 @@ namespace MyApp;
9999

100100
public class ConfigureProfiling : IHostingStartup
101101
{
102-
public void Configure(IWebHostBuilder builder)
103-
{
104-
builder.ConfigureAppHost(host => {
105-
host.Plugins.AddIfDebug(new RequestLogsFeature {
106-
EnableResponseTracking = true,
107-
});
108-
109-
host.Plugins.AddIfDebug(new ProfilingFeature {
110-
IncludeStackTrace = true,
111-
});
102+
public void Configure(IWebHostBuilder builder) => builder
103+
.ConfigureServices((context, services) => {
104+
if (context.HostingEnvironment.IsDevelopment())
105+
{
106+
services.AddPlugin(new ProfilingFeature
107+
{
108+
IncludeStackTrace = true,
109+
});
110+
}
112111
});
113-
}
114112
}
115113
```
116114

MyApp/_pages/admin-ui-profiling.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,32 @@ Which will add the [Modular Startup](/modular-startup) configuration to your Hos
1717
```csharp
1818
public class ConfigureProfiling : IHostingStartup
1919
{
20-
public void Configure(IWebHostBuilder builder)
21-
{
22-
builder.ConfigureAppHost(host => {
23-
host.Plugins.AddIfDebug(new RequestLogsFeature {
24-
EnableResponseTracking = true,
25-
});
26-
27-
host.Plugins.AddIfDebug(new ProfilingFeature {
28-
IncludeStackTrace = true,
29-
});
20+
public void Configure(IWebHostBuilder builder) => builder
21+
.ConfigureServices((context, services) => {
22+
if (context.HostingEnvironment.IsDevelopment())
23+
{
24+
services.AddPlugin(new ProfilingFeature
25+
{
26+
IncludeStackTrace = true,
27+
});
28+
}
3029
});
31-
}
3230
}
3331
```
3432

33+
Whilst Request Logs can be added with:
34+
35+
::: sh
36+
x mix requestlogs
37+
:::
38+
39+
Or if you prefer to store Request Logs in an SQLite database then use the following command:
40+
41+
::: sh
42+
x mix sqlitelogs
43+
:::
44+
45+
3546
The default configuration looks at providing useful information during development, where the response request bodies are captured in the Request Logger and the StackTrace is captured on the important events where they can be useful.
3647

3748
### Configuration

0 commit comments

Comments
 (0)