-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
548 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 17 additions & 18 deletions
35
src/Serilog.Sinks.Mongodb.TimeSeries/Configurations/LogCollectionConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
using MongoDB.Bson.Serialization; | ||
using Serilog.Sinks.Mongodb.TimeSeries.Models; | ||
|
||
namespace Serilog.Sinks.Mongodb.TimeSeries.Configurations | ||
namespace Serilog.Sinks.Mongodb.TimeSeries.Configurations; | ||
|
||
/// <summary> | ||
/// Holds the mongodb collection configuration for the <see cref="LogDocument" /> collection. | ||
/// </summary> | ||
internal static class LogCollectionConfig | ||
{ | ||
/// <summary> | ||
/// Holds the mongodb collection configuration for the <see cref="LogDocument" /> collection. | ||
/// Configures the mapping of the <see cref="LogDocument" /> object so it can be stored in a collection. | ||
/// </summary> | ||
internal static class LogCollectionConfig | ||
internal static void ConfigureLogDocumentCollection() | ||
{ | ||
/// <summary> | ||
/// Configures the mapping of the <see cref="LogDocument" /> object so it can be stored in a collection. | ||
/// </summary> | ||
internal static void ConfigureLogDocumentCollection() | ||
BsonClassMap.RegisterClassMap<LogDocument>(cm => | ||
{ | ||
BsonClassMap.RegisterClassMap<LogDocument>(cm => | ||
{ | ||
cm.AutoMap(); | ||
cm.MapField(x => x.Timestamp).SetElementName("timestamp").SetIsRequired(true); | ||
cm.MapField(x => x.Message).SetElementName("message").SetIsRequired(true); | ||
cm.MapField(x => x.Properties).SetElementName("properties").SetIsRequired(false); | ||
cm.MapField(x => x.Severity).SetElementName("severity").SetIsRequired(false); | ||
cm.MapField(x => x.Exception).SetElementName("exception").SetIsRequired(false).SetIgnoreIfNull(true); | ||
cm.MapField(x => x.StackTrace).SetElementName("stackTrace").SetIsRequired(false).SetIgnoreIfNull(true); | ||
}); | ||
} | ||
cm.AutoMap(); | ||
cm.MapField(x => x.Timestamp).SetElementName("timestamp").SetIsRequired(true); | ||
cm.MapField(x => x.Message).SetElementName("message").SetIsRequired(true); | ||
cm.MapField(x => x.Properties).SetElementName("properties").SetIsRequired(false); | ||
cm.MapField(x => x.Severity).SetElementName("severity").SetIsRequired(false); | ||
cm.MapField(x => x.Exception).SetElementName("exception").SetIsRequired(false).SetIgnoreIfNull(true); | ||
cm.MapField(x => x.StackTrace).SetElementName("stackTrace").SetIsRequired(false).SetIgnoreIfNull(true); | ||
}); | ||
} | ||
} |
Oops, something went wrong.