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 Dec 4, 2022
2 parents fcf10dc + cc76012 commit c4df07e
Show file tree
Hide file tree
Showing 23 changed files with 548 additions and 561 deletions.
17 changes: 10 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +25,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
24 changes: 12 additions & 12 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
<a href="https://github.com/BrammyS/Serilog.Sinks.Mongodb.TimeSeries">
<img src="https://cdn.brammys.com/potable-water.png" alt="Logo" width="120" height="120">
</a>
</p>

<h3 align="center">Serilog.Sinks.Mongodb.TimeSeries</h3>

<h3 align="center">Serilog.Sinks.Mongodb.TimeSeries</h3>

<p align="center">
A simple to use sink for Serilog that saves logs in a Mongodb time series collection.
<br />
<a href="https://sinks-mongodb-timeseries.brammys.com/"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/BrammyS/Serilog.Sinks.Mongodb.TimeSeries/issues">Report Bug</a>
·
<a href="https://github.com/BrammyS/Serilog.Sinks.Mongodb.TimeSeries/issues">Request Feature</a>
</p>
<p align="center">
A simple to use sink for Serilog that saves logs in a Mongodb time series collection.
<br />
<a href="https://sinks-mongodb-timeseries.brammys.com/"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/BrammyS/Serilog.Sinks.Mongodb.TimeSeries/issues">Report Bug</a>
·
<a href="https://github.com/BrammyS/Serilog.Sinks.Mongodb.TimeSeries/issues">Request Feature</a>
</p>


Expand Down
68 changes: 34 additions & 34 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,39 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
4 changes: 2 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [ ubuntu-latest ]
steps:
- name: Checkout
uses: actions/checkout@v1
Expand All @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-version: '7.0.x'

- name: Install dependencies
run: dotnet restore
Expand Down
50 changes: 25 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@ name: Publish nuget packages
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-alpha"
- "v[0-9]+.[0-9]+.[0-9]+-beta"
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-alpha"
- "v[0-9]+.[0-9]+.[0-9]+-beta"
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'

- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
- name: Set VERSION variable from tag
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV

- name: Build Serilog.Sinks.Mongodb.TimeSeries
run: dotnet build --configuration Release /p:Version=${VERSION}
- name: Build Serilog.Sinks.Mongodb.TimeSeries
run: dotnet build --configuration Release /p:Version=${VERSION}

- name: Run unit tests
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build
- name: Run unit tests
run: dotnet test --configuration Release /p:Version=${VERSION} --no-build

- name: Pack Serilog.Sinks.Mongodb.TimeSeries
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .
- name: Pack Serilog.Sinks.Mongodb.TimeSeries
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .

- name: Push Serilog.Sinks.Mongodb.TimeSeries github
run: dotnet nuget push Serilog.Sinks.Mongodb.TimeSeries.${VERSION}.nupkg --source https://nuget.pkg.github.com/brammys/index.json --api-key ${{ secrets.PAT }} --skip-duplicate
- name: Push Serilog.Sinks.Mongodb.TimeSeries github
run: dotnet nuget push Serilog.Sinks.Mongodb.TimeSeries.${VERSION}.nupkg --source https://nuget.pkg.github.com/brammys/index.json --api-key ${{ secrets.PAT }} --skip-duplicate

- name: Push Serilog.Sinks.Mongodb.TimeSeries nuget.org
run: dotnet nuget push Serilog.Sinks.Mongodb.TimeSeries.${VERSION}.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Push Serilog.Sinks.Mongodb.TimeSeries nuget.org
run: dotnet nuget push Serilog.Sinks.Mongodb.TimeSeries.${VERSION}.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json --skip-duplicate
4 changes: 2 additions & 2 deletions .github/workflows/publishDocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish documentation
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
runs-on: windows-latest
Expand All @@ -14,7 +14,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-version: '7.0.x'

- name: Install dependencies
run: dotnet restore
Expand Down
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);
});
}
}
Loading

0 comments on commit c4df07e

Please sign in to comment.