Skip to content

Commit ee5b097

Browse files
committed
Remove list indents (better rendering for HB docs)
1 parent 40958f5 commit ee5b097

File tree

1 file changed

+117
-93
lines changed

1 file changed

+117
-93
lines changed

README.md

Lines changed: 117 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,53 @@ See below for examples on how to configure Honeybadger for different types of ap
2222

2323
### For .Net Core Web App
2424

25-
1. Install Honeybadger.DotNetCore from Nuget
26-
```
27-
dotnet add package Honeybadger.DotNetCore
28-
```
29-
2. Register the _Honeybadger Middleware_:
30-
```c#
31-
var builder = WebApplication.CreateBuilder(args);
32-
builder.AddHoneybadger(new HoneybadgerOptions("apiKey"));
33-
```
34-
35-
Or you can configure Honeybadger through your `appsettings.json` file, by adding a `Honeybadger` section:
36-
```json
37-
{
38-
"Honeybadger": {
39-
"ApiKey": "apiKey",
40-
"AppEnvironment": "Development",
41-
"ReportData": true
42-
}
25+
#### 1. Install Honeybadger.DotNetCore from Nuget
26+
27+
```sh
28+
dotnet add package Honeybadger.DotNetCore
29+
```
30+
31+
#### 2. Register the _Honeybadger Middleware_:
32+
33+
```c#
34+
var builder = WebApplication.CreateBuilder(args);
35+
builder.AddHoneybadger(new HoneybadgerOptions("apiKey"));
36+
```
37+
38+
Or you can configure Honeybadger through your `appsettings.json` file, by adding a `Honeybadger` section:
39+
40+
```json
41+
{
42+
"Honeybadger": {
43+
"ApiKey": "apiKey",
44+
"AppEnvironment": "Development",
45+
"ReportData": true
4346
}
44-
```
45-
And simply call `AddHoneybadger` without any parameters:
46-
```c#
47-
var builder = WebApplication.CreateBuilder(args);
48-
builder.AddHoneybadger();
49-
```
47+
}
48+
```
49+
50+
And simply call `AddHoneybadger` without any parameters:
51+
52+
```c#
53+
var builder = WebApplication.CreateBuilder(args);
54+
builder.AddHoneybadger();
55+
```
5056

5157
#### Usage
5258

5359
You can access the _Honeybadger Client_ using _DI_:
60+
5461
```c#
5562
app.MapGet("/", ([FromServices] IHoneybadgerClient client) =>
5663
{
5764
client.AddBreadcrumb("reached index route", "route", new Dictionary<string, object?>());
58-
65+
5966
return "Hello World!";
6067
});
6168
```
6269

6370
Any unhandled exceptions should be reported to Honeybadger automatically (unless `ReportUnhandledExceptions` is set to false):
71+
6472
```c#
6573
app.MapGet("/debug", () =>
6674
{
@@ -70,83 +78,97 @@ app.MapGet("/debug", () =>
7078

7179
See example project in `examples/Honeybadger.DotNetCoreWebApp`.
7280

73-
### As a custom logging provider
74-
75-
1. Install Honeybadger.Extensions.Logging from Nuget
76-
```
77-
dotnet add package Honeybadger.Extensions.Logging
78-
```
79-
2. Register Honeybadger and additionally the custom logging provider:
80-
```c#
81-
var builder = WebApplication.CreateBuilder(args);
82-
// or set the configuration in the appsettings.json file
83-
builder.AddHoneybadger(new HoneybadgerOptions("apiKey"));
84-
builder.Logging.AddHoneybadger();
85-
```
86-
87-
You should also configure the minimum log level as you would configure other log providers in .Net Core.
88-
The following would report only logged errors:
89-
```json
90-
{
91-
"Logging": {
92-
"Honeybadger": {
93-
"Default": "Error"
94-
}
95-
}
81+
### As a custom logging provider
82+
83+
#### 1. Install Honeybadger.Extensions.Logging from Nuget
84+
85+
```sh
86+
dotnet add package Honeybadger.Extensions.Logging
87+
```
88+
89+
#### 2. Register Honeybadger and additionally the custom logging provider:
90+
91+
```c#
92+
var builder = WebApplication.CreateBuilder(args);
93+
// or set the configuration in the appsettings.json file
94+
builder.AddHoneybadger(new HoneybadgerOptions("apiKey"));
95+
builder.Logging.AddHoneybadger();
96+
```
97+
98+
You should also configure the minimum log level as you would configure other log providers in .Net Core.
99+
The following would report only logged errors:
100+
101+
```json
102+
{
103+
"Logging": {
104+
"Honeybadger": {
105+
"Default": "Error"
106+
}
96107
}
97-
```
98-
And simply call `AddHoneybadger` and `Logging.AddHoneybadger` without any parameters:
99-
```c#
100-
var builder = WebApplication.CreateBuilder(args);
101-
builder.AddHoneybadger();
102-
builder.Logging.AddHoneybadger();
103-
```
104-
Note: If you want to disable automatic reporting of unhandled exceptions, you can set the `ReportUnhandledExceptions` property to `false` in the `HoneybadgerOptions`:
105-
```json
106-
{
107-
"Honeybadger": {
108-
"ApiKey": "apiKey",
109-
"AppEnvironment": "Development",
110-
"ReportData": true,
111-
"ReportUnhandledExceptions": false
112-
}
108+
}
109+
```
110+
111+
And simply call `AddHoneybadger` and `Logging.AddHoneybadger` without any parameters:
112+
113+
```c#
114+
var builder = WebApplication.CreateBuilder(args);
115+
builder.AddHoneybadger();
116+
builder.Logging.AddHoneybadger();
117+
```
118+
119+
Note: If you want to disable automatic reporting of unhandled exceptions, you can set the `ReportUnhandledExceptions` property to `false` in the `HoneybadgerOptions`:
120+
121+
```json
122+
{
123+
"Honeybadger": {
124+
"ApiKey": "apiKey",
125+
"AppEnvironment": "Development",
126+
"ReportData": true,
127+
"ReportUnhandledExceptions": false
113128
}
114-
```
129+
}
130+
```
115131

116132
#### Usage
117133

118134
Errors from the `logger` will be reported to Honeybadger:
119-
```c#
120-
app.MapGet("/notify", ([FromServices] ILogger logger) =>
121-
{
122-
logger.LogError("hello from Honeybadger.Logger!");
123-
124-
return "Log reported to Honeybadger. Check your dashboard!";
125-
});
126-
```
135+
136+
```c#
137+
app.MapGet("/notify", ([FromServices] ILogger logger) =>
138+
{
139+
logger.LogError("hello from Honeybadger.Logger!");
140+
141+
return "Log reported to Honeybadger. Check your dashboard!";
142+
});
143+
```
127144

128145
See example project in `examples/Honeybadger.DotNetCoreWebApp.Logger`.
129146

130147
### Using the SDK manually
131148

132-
1. Install the [Honeybadger Nuget](https://www.nuget.org/packages/Honeybadger).
133-
```
134-
dotnet add package Honeybadger
135-
```
136-
2. Initialize the _Honeybadger Client_:
137-
```c#
138-
using Microsoft.Extensions.Options;
139-
140-
var options = new HoneybadgerOptions("apiKey");
141-
var client = new HoneybadgerClient(Options.Create(options));
142-
```
143-
3. Call `notify` to report to Honeybadger:
144-
```c#
145-
// blocking
146-
client.Notify("hello from .Net !");
147-
// or async
148-
await client.NotifyAsync("hello from .Net !");
149-
```
149+
#### 1. Install the [Honeybadger Nuget](https://www.nuget.org/packages/Honeybadger).
150+
151+
```sh
152+
dotnet add package Honeybadger
153+
```
154+
155+
#### 2. Initialize the _Honeybadger Client_:
156+
157+
```c#
158+
using Microsoft.Extensions.Options;
159+
160+
var options = new HoneybadgerOptions("apiKey");
161+
var client = new HoneybadgerClient(Options.Create(options));
162+
```
163+
164+
#### 3. Call `notify` to report to Honeybadger:
165+
166+
```c#
167+
// blocking
168+
client.Notify("hello from .Net !");
169+
// or async
170+
await client.NotifyAsync("hello from .Net !");
171+
```
150172

151173
See example project in `examples/Honeybadger.Console`.
152174

@@ -171,6 +193,7 @@ Conventional Commits are enforced with a pre-commit git hook (using [husky](http
171193

172194
All packages are published on nuget.org with a [Github Actions Worfklow](./.github/workflows/release.yml).
173195
The workflow does the following:
196+
174197
- `dotnet versionize` - bump versions and generate changelog
175198
- `dotnet pack`
176199
- `dotnet package push`
@@ -179,11 +202,12 @@ _Note: only users with write permissions can trigger this workflow (i.e. Collabo
179202

180203
### Manual Releases
181204

182-
Our automated release process is not yet fully functional for the following reason:
183-
Since `Honeybadger` is a dependency of `Honeybadger.Extensions.Logging` and `Honeybadger.DotNetCore`,
205+
Our automated release process is not yet fully functional for the following reason:
206+
Since `Honeybadger` is a dependency of `Honeybadger.Extensions.Logging` and `Honeybadger.DotNetCore`,
184207
we need to release `Honeybadger` first, then update the dependencies in the other projects and finally release those two projects.
185208

186209
To release manually, execute the following steps:
210+
187211
1. Run `dotnet versionize` in the root directory. This will bump the version in all projects and commit the new version as a tag.
188212
2. Run `dotnet pack ./src/Honeybadger --configuration Release`
189213
3. Run `dotnet nuget push ./src/Honeybadger/bin/Release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key YOUR_API_KEY`

0 commit comments

Comments
 (0)