Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
BrammyS committed Jul 24, 2021
2 parents 2ec6d6e + b3a8129 commit f5bfa1c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,29 @@ You will need to do the following to add Serilog.Sinks.Mongodb.TimeSeries as a s

```csharp
var client = new MongoClient("mongodb://mongodb0.example.com:27017");
var mongoDatabase = client.GetDatabase("logs");
var mongoDatabase = client.GetDatabase("dbName");

Log.Logger = new LoggerConfiguration()
.WriteTo.MongoDbTimeSeriesSink(mongoDatabase)
.CreateLogger();
```
OR
```csharp
var client = new MongoClient("mongodb://mongodb0.example.com:27017");
var mongoDatabase = client.GetDatabase("dbName");

var batchingConfig = new PeriodicBatchingSinkOptions
{
BatchSizeLimit = 250,
Period = TimeSpan.FromSeconds(20),
EagerlyEmitFirstEvent = true,
QueueLimit = 500
};

Log.Logger = new LoggerConfiguration()
.WriteTo.MongoDbTimeSeriesSink(mongoDatabase, batchingConfig)
.CreateLogger();
```

## 3. Compiling
You will need the following to compile Serilog.Sinks.Mongodb.TimeSeries:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class LoggerSinkConfigurationExtensions
/// to batch the logs.
/// </param>
/// <returns>
/// The new <see cref="LoggerSinkConfiguration" /> with new sink.
/// The new <see cref="LoggerSinkConfiguration" /> with the new sink.
/// </returns>
public static LoggerConfiguration MongoDbTimeSeriesSink(this LoggerSinkConfiguration loggerConfiguration, MongoDbTimeSeriesSinkConfig sinkConfig, PeriodicBatchingSinkOptions batchingOptions)
{
Expand All @@ -39,7 +39,7 @@ public static LoggerConfiguration MongoDbTimeSeriesSink(this LoggerSinkConfigura
/// to batch the logs.
/// </param>
/// <returns>
/// The new <see cref="LoggerSinkConfiguration" /> with new sink.
/// The new <see cref="LoggerSinkConfiguration" /> with the new sink.
/// </returns>
public static LoggerConfiguration MongoDbTimeSeriesSink(this LoggerSinkConfiguration loggerConfiguration, IMongoDatabase database, PeriodicBatchingSinkOptions batchingOptions)
{
Expand All @@ -52,7 +52,7 @@ public static LoggerConfiguration MongoDbTimeSeriesSink(this LoggerSinkConfigura
/// <param name="loggerConfiguration">The <see cref="LoggerSinkConfiguration" />.</param>
/// <param name="database">The database of where the logs will be stored.</param>
/// <returns>
/// The new <see cref="LoggerSinkConfiguration" /> with new sink.
/// The new <see cref="LoggerSinkConfiguration" /> with the new sink.
/// </returns>
public static LoggerConfiguration MongoDbTimeSeriesSink(this LoggerSinkConfiguration loggerConfiguration, IMongoDatabase database)
{
Expand Down

0 comments on commit f5bfa1c

Please sign in to comment.