Skip to content
This repository was archived by the owner on Jun 1, 2024. It is now read-only.

Commit 67175c8

Browse files
Vadim Hatsuramivano
authored andcommitted
Notes about formatters in readme (#209)
* Add small info regarding formatters into readme * add nuget badge to readme
1 parent 3feba63 commit 67175c8

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# Serilog.Sinks.Elasticsearch
1+
# Serilog.Sinks.Elasticsearch [![Build status](https://ci.appveyor.com/api/projects/status/bk367tcnx9qt2sjy/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-elasticsearch/branch/master) [![NuGet Badge](https://img.shields.io/nuget/v/Serilog.Sinks.Elasticsearch.svg)](https://www.nuget.org/packages/Serilog.Sinks.Elasticsearch)
22

3-
[![Build status](https://ci.appveyor.com/api/projects/status/bk367tcnx9qt2sjy/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-elasticsearch/branch/master)
3+
This repository contains two nuget packages: `Serilog.Sinks.Elasticsearch` and `Serilog.Formatting.Elasticsearch`.
44

55
## Table of contents
66

77
* [What is this sink](#what-is-this-sink)
88
* [Features](#features)
99
* [Quick start](#quick-start)
10+
* [Elasticsearch sinks](#elasticsearch-sinks)
11+
* [Elasticsearch formatters](#elasticsearch-formatters)
1012
* [More information](#more-information)
1113
* [A note about fields inside Elasticsearch](#a-note-about-fields-inside-elasticsearch)
1214
* [A note about Kibana](#a-note-about-kibana)
@@ -30,6 +32,8 @@ The Serilog Elasticsearch sink project is a sink (basically a writer) for the Se
3032

3133
## Quick start
3234

35+
### Elasticsearch sinks
36+
3337
```powershell
3438
Install-Package serilog.sinks.elasticsearch
3539
```
@@ -88,6 +92,24 @@ With the appSettings configuration the `nodeUris` property is required. Multiple
8892

8993
And start writing your events using Serilog.
9094

95+
### Elasticsearch formatters
96+
97+
```powershell
98+
Install-Package serilog.formatting.elasticsearch
99+
```
100+
101+
The `Serilog.Formatting.Elasticsearch` nuget package consists of a several formatters:
102+
103+
* `ElasticsearchJsonFormatter` - custom json formatter that respects the configured property name handling and forces `Timestamp` to @timestamp.
104+
* `ExceptionAsObjectJsonFormatter` - a json formatter which serializes any exception into an exception object.
105+
106+
Override default formatter if it's possible with selected sink
107+
108+
```csharp
109+
var loggerConfig = new LoggerConfiguration()
110+
.WriteTo.Console(new ElasticsearchJsonFormatter());
111+
```
112+
91113
## More information
92114

93115
* [Basic information](https://github.com/serilog/serilog-sinks-elasticsearch/wiki/basic-setup) on how to configure and use this sink.

sample/Serilog.Sinks.Elasticsearch.Sample/Serilog.Sinks.Elasticsearch.Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

0 commit comments

Comments
 (0)