Skip to content

Commit a8f4f32

Browse files
authored
Update README #32
1 parent 596be44 commit a8f4f32

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SplunkLogger
2-
This is a C# .Net Core 2 ILogger implementation developed by **VTEX** developer (@[Caldas](https://github.com/Caldas)) to send data to Splunk.
2+
This is a C# .Net Core 2 ILogger implementation developed by **VTEX** developer [Caldas](https://github.com/Caldas) to send data to Splunk.
33

44
### Features
55

@@ -23,7 +23,7 @@ PM> Install-Package SplunkLogger
2323

2424
### Configure Logger
2525

26-
Let's say for instance that your are creating a WebAPI project, so the first step is to configure one of the Splunk loggers options
26+
Let's say for instance that you are creating a WebAPI project, so the first step is to configure one of the Splunk loggers options:
2727
```csharp
2828
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
2929
{
@@ -43,15 +43,14 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
4343
}
4444
```
4545

46-
As you can see, no matter what is your option you always must delivery a *SplunkLoggerConfiguration* that can be provided by two ways:
46+
As you can see, no matter what is your option you always must delivery a *SplunkLoggerConfiguration* when adding a ILogger to the logger factory. You can provide it via config or as hard code:
4747

4848
#### Get Configuration From Json File
4949

50-
First, and most beautiful one.
50+
You can provide the configuration from json file using .Net Core 2 configuration binding feature.
5151

52-
You can provide the configuration from json file. In this case I will be using *appsettings.json* as source and loading it using .Net Core 2 configuration binding feature.
52+
For instance at [SampleWebAPI project](https://github.com/vtex/SplunkLogger/tree/master/src/SampleWebAPI) we use the *appsettings.json* file.
5353

54-
So first, let's check the json file.
5554
```json
5655
{
5756
"Logging": {
@@ -81,9 +80,9 @@ So first, let's check the json file.
8180
}
8281
```
8382

84-
If you intend to use send data via **Http** you should set **HecConfiguration** section and if you choose to send data via socket you must set **SocketConfiguration** section.
83+
If you intend to send data via **Http** you should set **HecConfiguration** section and if you choose to send data via socket you must set **SocketConfiguration** section.
8584

86-
Now we need to configure SplunkLoggerConfiguration and indicate to use **Splunk** section from configuration file.
85+
Now we need to configure SplunkLoggerConfiguration at dependency injection and indicate to use **Splunk** section from configuration file.
8786
```csharp
8887
/// <summary>
8988
/// This method gets called by the runtime. Use this method to add services to the container.
@@ -112,7 +111,7 @@ SplunkLoggerConfiguration GetSplunkLoggerConfiguration(IApplicationBuilder app)
112111

113112
#### Get Static Configuration
114113

115-
You can also provide a hard coded configuration instance:
114+
If you don't want to use the configuration file, you can provide a hard coded configuration instance:
116115

117116
```csharp
118117
/// <summary>
@@ -140,11 +139,13 @@ SplunkLoggerConfiguration GetSplunkLoggerConfiguration(IApplicationBuilder app)
140139
}
141140
```
142141

143-
If you intend to use send data via **Http** you should set **HecConfiguration** property and if you choose to send data via socket you must set **SocketConfiguration** property.
142+
Again, if you intend to use send data via **Http** you should set **HecConfiguration** property and if you choose to send data via socket you must set **SocketConfiguration** property.
144143

145-
### Sample Logging
144+
### Logging
146145

147-
At controller you must receive `ILoggerFactory loggerFactory` and extract `ILogger`from it and use this `ILogger` instance to log any desired event, as sample below:
146+
Now that everything is configured and ILoggerFactory already have the desired ILogger instance added you can log your messages.
147+
148+
Here is a sample of how you can log messages, in this case I'm logging a `NotImplementedException` at [SampleWebAPI project](https://github.com/vtex/SplunkLogger/tree/master/src/SampleWebAPI) `ValuesController`.
148149

149150
```csharp
150151
[Route("api/[controller]")]
@@ -167,6 +168,6 @@ public class ValuesController : Controller
167168
}
168169
```
169170

170-
### Sending Http Events As Batchs
171+
## More Information
171172

172-
**To Be Definied**
173+
You can read more about the projects and it's details at [Wiki page](https://github.com/vtex/SplunkLogger/wiki)

0 commit comments

Comments
 (0)