You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extensive documentation for Microsoft.Extensions.Logging is available [here](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/) and should cover most general aspects of this library.
14
+
15
+
Once your Azure Event Hubs resource is configured in Azure, you can then add its details to your configuration. The options expose 4 values that you can later use:
The formatting of event data is controlled by an instance of this interface. A default implementation is supplied out of the box, which formats events as JSON:
45
+
46
+
```json
47
+
{
48
+
"Timestamp": "2019-07-11T08:53:37.772Z",
49
+
"LogLevel": "Information",
50
+
"Category": "MyApplication",
51
+
"EventId": 0,
52
+
"Message": "Application started.",
53
+
"Exception": null
54
+
}
55
+
```
56
+
57
+
To implement your own custom format, create your own implementation of `IAzureEventHubsLoggerFormatter` and replace the default instance in your service collection.
58
+
59
+
Custom implementations will have access to external scope data, provided by `IExternalScopeProvider`. To consume this, use the `ForEachScope` method exposed by `IAzureEventHubsLoggerFormatter`.
60
+
61
+
### `IAzureEventHubsLoggerProcessor`
62
+
63
+
The processing of event data is controlled by an instance of this interface. A default implementation is supplied that implements a queue, offloads work to a background thread, and sends event data using batches.
64
+
65
+
The options expose 2 (optional) values to customise the thresholds and queuing logic of the default processor:
66
+
67
+
```json
68
+
{
69
+
"Logging": {
70
+
"AzureEventHubs": {
71
+
"QueueDepth": 1024,
72
+
"QueueMode": "DropOldest"
73
+
}
74
+
}
75
+
}
76
+
```
77
+
78
+
`QueueDepth` must be a positive integer, and defaults to 1024. `QueueMode` can accept one of the values of [`BoundedChannelFullMode`](https://docs.microsoft.com/en-us/dotnet/api/system.threading.channels.boundedchannelfullmode), and defaults to `DropOldest`.
79
+
80
+
To implement your own custom processing logic, create your own implementation of `IAzureEventHubsLoggerProcessor` and replace the default instance in your service collection.
0 commit comments